Ad
  • Default User Avatar

    i used my solution for the first kata and adjusted it to fit the non adjacency rule . now it's passing all of the tests exepct like 5 of them that are like this example :
    input:
    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
    [1, 1, 0, 0, 0, 0, 0, 0, 1, 0],
    [1, 1, 0, 0, 1, 1, 1, 0, 1, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    after running the code :
    [4, 3, 1, 0, 0, 0, 0, 0, 0, 0],
    [4, 3, 0, 0, 0, 0, 0, 0, 2, 0],
    [4, 3, 0, 0, 3, 3, 3, 0, 2, 0],
    [4, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 2, 2, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    as you can see its prioritizing bigger ships first wich doesnt work in a minority of the cases.
    any suggestions on how i should assign ships when they are next to each other

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    I do not like that I cannot see the test because the messages I was getting for my failures were never correct, so it was extremely hard to debug, and I eventually gave up on this kata.

    It was telling me things like "must return False if there are diagonals" (my code could not even count diagonals) and "must return True with ships touching," but it did, and it never failed on account of ships touching, so I had no idea what was wrong with my code, and it was just frustrating.

    Is there any way for you to make the tests viewable?

  • Default User Avatar

    I have a very weird error in Ruby:
    [code] dfs(board, size, pieces, visited, context, m, m) # <<-- #<ArgumentError: wrong number of arguments (given 7, expected 5)>

    Method 'dfs' expects 7 arguments, yet the error message states it expects 5. Where does this number come from? This issue suddenly arises in the random tests, the predetermined tests run smoothly.
    I am logging all arguments before the method call, and indeed I'm providing 7 arguments.
    [code] def dfs(board, size, pieces, visited, context, m, k) # <<-- 7 arguments, so why do I occasionally get an error that 5 is expected ..