Ad
  • Custom User Avatar

    "-> nope, that list of attacks leads actually to the numbers 2,2,1,1, boats 1 & 2 sunken, the "3" untouched."

    I do indeed get the numbers 2,2,1,1 and thus 1 boat is sunken, 1 damaged, and 1 untouched. Just like the second sample test case is expecting. I am solving in ruby.

    So this is in contrast to the result that Blind4Basics gave that 2 boats are sunken. I got confused by that comment and somehow overlooked that boat 1 had a length of 3 in the example given.

    Anyway nice kata, I did get confused but that is not necessarily bad practice in my opinion.

  • Custom User Avatar

    i get that this is a code kata and probably designed to be counter-intuitive but i'm not sure who in their right mind would ever lay out a grid like that. Luckily ruby has a reverse function :)

  • Custom User Avatar

    I had exactly the same problem. I don´t know why the coordinates are upside down, but worse than that, test case number 1 works by mere chance if you do it the wrong way.

  • Custom User Avatar

    read again the description, you're definitely not applying the coordinates correctly. ;)

  • Custom User Avatar

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

  • Custom User Avatar

    Unfortunately, I have to disappoint you, because if I follow your instruction and take the first number as x-coordinate (as stated in the description) and the second as y-coordinate, I get 2,1 = 0 (first row, second column). If I change the coordinates, 2,1 gives back 3 (second row, first column). If I index the first row as 0, I get into trouble with the last one, because 3,3 is out of range.

  • Custom User Avatar

    Hi,

    • first, that's not an issue, that's a question. ;) (issues are for non working katas, erorrs in the tests,...)
    • second, read again the description, you're missing the main information, here.
    • "I get the numbers 0, 0, 1, 1" -> nope, that list of attacks leads actually to the numbers 2,2,1,1, boats 1 & 2 sunken, the "3" untouched.
  • Custom User Avatar

    I'm solving the cata with python, and I can't really figure out how there's a sunken, a damaged and an untouched boat in the second basic test case. Because the board looks like this:

    board = [ [3, 0, 1],
    [3, 0, 1],
    [0, 2, 1],
    [0, 2, 0] ]

    And the attacks [[2, 1], [2, 2], [ 3, 2], [3, 3]].

    So if I follow the coordinates of the attacks, I get the numbers 0, 0, 1, 1, which means that one boat is damaged and two boats are untouched. Even if I assume that the first line was accidentally copied into this test case, I only get 1 sunken boat, 0 damaged and 2 untouched.