Ad
  • Default User Avatar

    @FArekkusu - your drawing is deceptively misleading. First off, the kata does not explain that there could be obstacles in the path. Secondly the path to get to the target, with the obstacle, would be

    NORTH WEST WEST SOUTH SOUTH SOUTH EAST EAST
    

    and

    SOUTH SOUTH 
    

    without the obstacle.

    I'm sure you can cook up an example with an obstacle (perhaps a one way door?) where the paths

      NORTH SOUTH EAST WEST 
      NORTH EAST WEST SOUTH 
    

    (or similar) are not equivalent.

    The kata is ill-posed because the it gives the impression of a single algebraic set, but the test uses two separate sets.

    Please consider updating the kata description to clarify the intent. Thanks.

  • Default User Avatar

    Well, the kata says it takes place in the desert, and while I guess you can have insurmountable dunes, it does not include such enitites in the description (which would be an entirely different problem). The drawing above is furthermore misleading - on the left hand side you go 2 steps east, then 1 north (even if it is drawn as 2 east, 2 north) while on the right hand side it is 3 north, 1 east (again, drawn as 3 north, 2 east). Assuming that each step of the instructions are all of unit 1 (otherwise, SOUTH NORTH would not necessarily end up the same place), the drawings really reprents the two paths

    EAST EAST NORTH   
    NORTH NORTH NORTH EAST
    

    which are clearly not the same thing.

    The kata really only need a few words to make the task more clear, such as to say what is meant by not reasonable i.e., two consequitive steps in opposing directions.

    I think the confussion comes from the fact that naturally takes the set of operations {NORTH,SOUTH,EAST,WEST} as commutative and associative. That is for any three operators a, b, and c in the set

    a * b = b * a
    (a * b) * c = a * (b * c)
    

    but the test breaks that intuition. What the test seems to say is that operators in the same vertical or horizontal direction are commutative

    NORTH SOUTH = SOUTH NORTH = id
    WEST EAST = EAST WEST = id
    

    but not between horizontal and vertical directions

    NORTH EAST /= EAST NORTH
    WEST SOUTH /= SOUTH WEST 
    

    nor are the operations associative between vertical and horizontal

    (NORTH SOUTH) EAST /= NORTH (SOUTH EAST) 
    

    (this may seem odd, but on the left-hand side the (NORTH SOUTH) is the identity, but on the right hand side (SOUTH EAST) does not reduce). Thus, the kata is really dealing with two algebraic groups

    {NORTH,SOUTH,id}
    {EAST,WEST,id}

    for which the convolution operations are commutative and associative within each group separately but not between the groups. This, I think, is not how people read the kata - they think of the single algebraic group

    {NORTH,SOUTH,EAST,WEST,id}

    with a single convolution operator.

  • Default User Avatar

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