Ad
  • Default User Avatar

    actualy, [(1), 1], [1, (1)] must return True, cause [(1), 1], [1, (1)] same to [1, 1], [1, 1] and its the same structure. But yeah, i get the point ([(1,), 1], [1, (1,)]), just little detail...

  • Custom User Avatar

    U,D,L,R = cockroaches with initial directions facing UP, DOWN, LEFT, RIGHT

    initial direction

    When they hit a wall they always turn LEFT and then they follow the wall until they can find a hole to crawl into!

  • Custom User Avatar

    Yes, first it goes down until the wall, then follows it and the first hole it meets is 1 (it would need to continue upward to see the 2). The letter only tells you the direction it follows until hitting a wall.

  • Custom User Avatar

    From the first picture, the cockroach goes down to the bottom wall, then left (from cockroach's perspective, but right from birds eye view) across the bottom wall, then up the right wall and into hole 2. I wouldn't have drawn the second picture, because I didn't think of the D cockroach as turning into a U cockroach. Rather, my D cockroach was just sometimes in a "move left along wall until hole" phase.