Ad
  • Custom User Avatar

    A very clever solution. This helped me understand reduce better.

  • Custom User Avatar

    This one really tested my patience. Nice kata!

  • Custom User Avatar

    Thanks, I'm glad you like the kata! I got the idea from another code challenge that simulated the spread of a virus by infecting neighboring cells. I have updated the random tests to use Test.assertEquals.

  • Custom User Avatar

    There are some problems with the Python and Ruby random tests.

  • Custom User Avatar

    @adrian.eyre I'm having some trouble understanding your logic, could you please help me understand? It looks like you are generating the board and populating it with random numbers. After generating the numbers (num1, num2, num3, num4), your code adds these numbers to the pre-existing integer already in that position. This will not always result in 4 numbers whose sum is a perfect cube.

    Also, I've hardcoded in the numbers from the test case I provided above (xc=2, yc=4), and have encountered a few cases producing a board with 0 lucky sevens. The description states at least 1 lucky seven will be present in the array.

    Thanks again for your help with these translations, I'm happy this kata is getting some attention. Let's get these tests figured out so we can move out of beta!

  • Custom User Avatar

    Thanks! I've been playing around with the Python translation and noticed a few inconsistencies. It looks like your code does not always insert the lucky seven correctly. Here's an example...

    num=8
    num1=2
    num2=0
    num3=0
    num4=6
    
    board = [
              ['x', 'x', 'x', 'x', 'x'],
              ['x', 'x', 'x', 'x', 2],
              ['x', 'x', 'x', 0, 7],
              ['x', 'x', 'x', 'x', 0],
              ['x', 'x', 'x', 'x', 'x']
             ]
    

    You could fix this by checking for a valid insertion point before inserting the lucky seven. Also, when inserting multiple lucky sevens, your code will overwrite existing lucky sevens. This will not always produce invalid test cases, but I don't believe it's the expected behaviour and should be fixed.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You need to declare the variable i when constructing your for loop.

  • Custom User Avatar

    Excellent kata, thanks!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution