Ad
  • Custom User Avatar

    Really fun kata, good stuff

    took a while to get my head around it, i still find it confusing how it works lol

  • Custom User Avatar

    yup, it is the size of the grid, and i think maybe it's just a little more readable that way.

  • Custom User Avatar

    I came here to give the same comment.
    Upvote this one instead.

  • Custom User Avatar

    Hi

    What is the use of the 3rd parameter : size of the grid ?

    The length of the 1st parameter : grid has the same value

  • Custom User Avatar

    .

  • Custom User Avatar

    Approved, thanks.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Very interesting.

  • Custom User Avatar

    im amazed by these one line solutions!
    nicely done.

  • Custom User Avatar

    Oh, I got it now. You were right, I was couting rows and columns (row 0, row 1..., column 0, column 1). Thanks so much!

  • Custom User Avatar
    grid = [
        0123x
      0'aB..',
      1'##@#',
      2'$Ab#'
      y
    ]
    

    0, 0 is top left, that's an a
    with x-axis being right-left, that means @ is two steps right, so x-axis is 2, and it's one down, so y-axis is 1: (x, y) (2, 1)
    I.. don't see how you're getting (1, 2) for @

    (1,2) (x,y), and the first step in order to go to the key is going up to (0,2)

    if (1,2) is x,y, then you changed the x coordinate but said you're going up, which is vertical(up/down) movement, but you said x is horizontal(left/right)

    .. no clue where we're viewing this differently x)

  • Custom User Avatar

    I explained bad myself, I think. Not talking of writting the grid but the position you should step. I mean, in the first example the first position (the starting "@") should be (1,2) (x,y), and the first step in order to go to the key is going up to (0,2), right? So when you say the array that should be returned with the pair x-y steps, you said "[(2, 1), (2, 0)...", there is where I am lost. Sorry for my clumsy english, I am explaining myself as hell...

  • Custom User Avatar

    Do you mean that you're writing grid[x][y]? That would be you swapping them, since grid contains rows, not columns.

    avoiding the variable names x and y may help. try row and col. and you should always consider re-structuring any input data you receive to suit you.

  • Custom User Avatar

    Hello, sorry for the dumb-newbie question but I don't understand the first example. I mean, I suppose isn't wrong 'cause have been tested and achieved so some of them will pointed to it of ot were the case, but, "x" and "y" seems to be swapped to me. If "x" is for horizontal and "y" is for vertical: won't be "@" (1, 2) and first step to (0, 2), then (0, 1) and so on? Thanks.

  • Loading more items...