Ad
  • Custom User Avatar

    Hi @Raphango, I've had time this morning to look into this :-)

    I believe it's your code that is wrong sorry :-( I've selected 3 sample random tests that failed using your code and validated them in Javascript against the 5 people who have solved the kata plus my own code and they all passed. I then used the tests against my Python code and that passed also.

    I wondering if it's because the line input isn't always sorted numerically why it's failing? I've updated the description with this information.

    If you would like to validate yourself the tests were...

    Test 1

    board = 5
    
    original = [2, 3, 5, 8, 10, 12, 14, 15, 16, 18, 19, 20, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 36, 37, 38, 40, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 9, 11, 4, 17, 21, 22, 13, 35, 43, 59, 60, 7]
    
    result = [2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60]
    
    game = Game(board)
    test.assert_equals(game.play(original), result)
    

    Test 2

    board = 9
    
    original = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 124, 125, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 163, 164, 165, 166, 167, 169, 170, 173, 174, 175, 177, 178, 10, 16, 17, 29, 31, 32, 49, 51, 62, 41, 48, 73, 82, 93, 109, 122, 123, 126, 130, 161, 176, 168, 179]
    
    result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 173, 174, 175, 176, 177, 178, 179]
    
    game = Game(board)
    test.assert_equals(game.play(original), result)
    

    Test 3

    board = 23
    
    original = [4, 6, 10, 13, 16, 18, 20, 24, 26, 28, 32, 34, 35, 36, 44, 45, 46, 47, 54, 55, 56, 58, 59, 61, 67, 69, 72, 76, 78, 83, 85, 90, 91, 92, 98, 99, 102, 103, 105, 106, 108, 109, 113, 119, 121, 125, 128, 129, 130, 133, 142, 144, 145, 148, 149, 151, 154, 157, 163, 168, 169, 173, 176, 182, 187, 189, 190, 191, 192, 195, 199, 205, 207, 211, 212, 216, 217, 239, 242, 244, 247, 253, 255, 256, 257, 259, 264, 277, 279, 284, 286, 287, 288, 290, 291, 292, 294, 298, 301, 320, 321, 323, 332, 335, 336, 337, 340, 344, 347, 353, 359, 362, 363, 364, 365, 368, 377, 382, 386, 393, 395, 396, 402, 405, 412, 415, 418, 420, 424, 432, 438, 439, 441, 444, 445, 449, 453, 454, 460, 461, 464, 469, 474, 477, 479, 482, 489, 492, 494, 495, 497, 498, 503, 506, 507, 510, 514, 515, 521, 522, 524, 526, 527, 529, 531, 532, 533, 547, 548, 549, 555, 556, 557, 561, 564, 570, 576, 577, 578, 581, 585, 587, 592, 594, 603, 605, 613, 619, 620, 622, 628, 630, 631, 635, 639, 644, 647, 652, 653, 655, 656, 657, 658, 659, 664, 665, 671, 672, 673, 674, 675, 676, 678, 680, 681, 682, 684, 688, 692, 696, 702, 711, 713, 714, 718, 719, 720, 722, 723, 725, 726, 735, 738, 739, 742, 743, 744, 746, 749, 756, 759, 762, 763, 764, 767, 768, 771, 772, 774, 776, 777, 778, 780, 781, 786, 789, 790, 793, 796, 799, 800, 801, 804, 805, 806, 807, 818, 820, 821, 825, 830, 834, 835, 837, 840, 842, 843, 844, 848, 850, 857, 865, 872, 873, 876, 889, 891, 893, 896, 900, 902, 911, 915, 923, 924, 927, 930, 933, 934, 935, 937, 938, 939, 944, 951, 956, 963, 964, 966, 969, 970, 971, 973, 974, 975, 978, 980, 981, 982, 983, 984, 993, 994, 995, 996, 1002, 1006, 1007, 1008, 1010, 1011, 1012, 1018, 1019, 1020, 1025, 1031, 1032, 1036, 1040, 1041, 1042, 1043, 1045, 1047, 1048, 1052, 1053, 1056, 1064, 1072, 1084, 1090, 1095, 1096, 1098, 1099, 1100, 1103, 43, 11, 12, 22, 79, 80, 82, 84, 114, 122, 126, 81, 152, 153, 167, 175, 215, 297, 358, 387, 339, 468, 430, 502, 505, 571, 554, 579, 580, 604, 627, 651, 654, 629, 677, 633, 634, 687, 695, 697, 650, 701, 694, 766, 748, 715, 753, 754, 757, 813, 824, 841, 867, 849, 947, 958, 962, 998, 946, 1005, 959, 960, 1017, 1055, 1016, 1071]
    
    result = [4, 6, 10, 11, 12, 13, 16, 18, 20, 22, 24, 26, 28, 32, 34, 35, 36, 43, 44, 45, 46, 47, 54, 55, 56, 58, 59, 61, 67, 69, 72, 76, 78, 79, 80, 81, 82, 83, 84, 85, 90, 91, 92, 98, 99, 102, 103, 105, 106, 108, 109, 113, 114, 119, 121, 122, 125, 126, 128, 129, 130, 133, 142, 144, 145, 148, 149, 151, 152, 153, 154, 157, 163, 167, 168, 169, 173, 175, 176, 182, 187, 189, 190, 191, 192, 195, 199, 205, 207, 211, 212, 215, 216, 217, 239, 242, 244, 247, 253, 255, 256, 257, 259, 264, 277, 279, 284, 286, 287, 288, 290, 291, 292, 294, 297, 298, 301, 320, 321, 323, 332, 335, 336, 337, 339, 340, 344, 347, 353, 358, 359, 362, 363, 364, 365, 368, 377, 382, 386, 387, 393, 395, 396, 402, 405, 412, 415, 418, 420, 424, 430, 432, 438, 439, 441, 444, 445, 449, 453, 454, 460, 461, 464, 468, 469, 474, 477, 479, 482, 489, 492, 494, 495, 497, 498, 502, 503, 505, 506, 507, 510, 514, 515, 521, 522, 524, 526, 527, 529, 531, 532, 533, 547, 548, 549, 554, 555, 556, 557, 561, 564, 570, 571, 576, 577, 578, 579, 580, 581, 585, 587, 592, 594, 603, 604, 605, 613, 619, 620, 622, 627, 628, 629, 630, 631, 633, 634, 635, 639, 644, 647, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 664, 665, 671, 672, 673, 674, 675, 676, 677, 678, 680, 681, 682, 684, 687, 688, 692, 694, 695, 696, 697, 701, 702, 711, 713, 714, 715, 718, 719, 720, 722, 723, 725, 726, 735, 738, 739, 742, 743, 744, 746, 748, 749, 753, 754, 756, 757, 759, 762, 763, 764, 766, 767, 768, 771, 772, 774, 776, 777, 778, 780, 781, 786, 789, 790, 793, 796, 799, 800, 801, 804, 805, 806, 807, 813, 818, 820, 821, 824, 825, 830, 834, 835, 837, 840, 841, 842, 843, 844, 848, 849, 850, 857, 865, 867, 872, 873, 876, 889, 891, 893, 896, 900, 902, 911, 915, 923, 924, 927, 930, 933, 934, 935, 937, 938, 939, 944, 946, 947, 951, 956, 958, 959, 960, 962, 963, 964, 966, 969, 970, 971, 973, 974, 975, 978, 980, 981, 982, 983, 984, 993, 994, 995, 996, 998, 1002, 1005, 1006, 1007, 1008, 1010, 1011, 1012, 1016, 1017, 1018, 1019, 1020, 1025, 1031, 1032, 1036, 1040, 1041, 1042, 1043, 1045, 1047, 1048, 1052, 1053, 1055, 1056, 1064, 1071, 1072, 1084, 1090, 1095, 1096, 1098, 1099, 1100, 1103]
    
    game = Game(board)
    test.assert_equals(game.play(original), result)
    

    Hope this helps

  • Custom User Avatar

    Cool, I'm just comparing my Python translation with my Javascript translation as I know 5 people have solved that. They are both the same as far as I can see but I maybe wrong. Please feel free to look at the kata's test code....I know this will for forfeit your solution, which I appologise for but I'd appreciate the feedback.

  • Custom User Avatar

    Hi @Raphango, let me just double check everything :-)

  • Default User Avatar

    matt c, It's not working:(

  • Default User Avatar

    There can be more than 3 functions.

  • Custom User Avatar

    I fixed 2 typos, let me know if I missed some.
    I tried to put some emphasis on the reversing part too.

  • Custom User Avatar

    This solution was written in python 2. You are probably using Python 3.
    The / operator represents integer division in python2 while float division in python 3.
    Replacing it with // should work.

  • Custom User Avatar

    you just have to print Hello World! to the console.

  • Custom User Avatar

    Thanks :)