# The Fall - Episode 2 - Puzzle discussion

I believe that the wording of the problem is somewhat misleading. Specifically:

â€śThe game ends when â€¦ Indy finds himself in the same room as a rock on the same turn: you have failedâ€ť

When I first read this, I wondered to myself, â€śWhat happens if Indy and the rock go down two different paths in a Type 4?â€ť According to a strict interpretation of the above statement, Indy would die. I decided to code my program as such since it made the logic easier to handle.

However, I was unable to solve the â€śRocks 2â€ť test case until I changed my logic. I made it so that if a rock hits a wall and disappears on the tile that Indy is in, then Indy doesnâ€™t die. The specific example I was working with was Indy and the rock both entering a Type 9 simultaneously, Indy from the TOP, and the rock from the RIGHT.

Once I made this logic change, then I was able to pass all tests. My program still assumes that Indy will die if he and a rock simultaneously go down different paths of a Type 4 (since the rock doesnâ€™t hit a wall). This logic flaw did not prevent me from passing the tests, though.

• dan
6 Likes

Isnâ€™t the example wrong ?

2 4
4 -3
12 -10
11 5
2 3
1

It says 12, but 12 would be the right path once it has turned. How can we detect it should turn if it has correct number already ?

I think it should be 11 to reflect the picture, no ?

Please provide in.txt and out.txt files for the tests, so we can debug the program outside CodinGame.

You canâ€™t have in/out files as they depend on what you do.

the in.txt however still exists but is not available for players.

Input depends on which path you take and/or when rocks are destroyed, so there canâ€™t be any static in.txt neither. ;)(Edit: or it contains only intialization data)

Input is input, that said, initialization data, the whole map you get on first turn of this game. (+ the position of the boulder and when they will appears too).

I know this because Iâ€™m working with the team too

I have no idea where my code is failing, I needed to debug it properly

I printed the input of the first 3 tests to stderr, so I could debug it using my default IDE. If someone else need the input to debug your code, I put it here: http://pastebin.com/yAr5HFnm

1 Like

Thanks Dan, this will help me. Mc

I am having issues figureing out what to do,

I can plan ahead to the bottom a bit, thatâ€™s what I have now in my code, however this fails a lot of times, Is the idea to recursively find a route from the exit to the start?

Or am i missing some basic logic?

I need some help with where Iâ€™ve mistaken in my logic, please. In #4 Broken mausoleum test case:
-3, 11, 5, 11, 2, 2, 3, 3, 8, 8, 5(fork, dead end to the right) 1 6 10(fork, dead end to the right), 3, 3, 11, 6, 4(fork with both dead ends, to the right and to the left). So in my logic itâ€™s impossible to get to the exit.

TIA,

Iâ€™m not sure I understand what you mean. If you do the right set of rotations you can reach the exit. The series of number you posted can be rotated to make a path that ends correctly.

Iâ€™m definitely rotating them, but still canâ€™t get to the exit. Unless for rooms types 1 and 8 Indy can go Â horizontally passing the â€śholeâ€ť that leads down. Can he?

He canâ€™t ! But the way you are " looking at a correct way" is not good.
In my solution, Indy enters the 8-th row from the far right side of the level (last column) Try to look for a path that goes a bit like this

So he goes from the room type 8 (the last in the 7-th row) down to the room type 12? You may enter 12 from TOP only if you rotate it LEFT, but then the next room would be to the right and out of the grid.

Nope, you rotate it twice to get to a room type 10, and then get back to the left of the level

â€ścertain rooms can now be rotatedÂ each turn by a quarter turn clockwise or counterclockwise.â€ť So you may rotate rooms 2 times (1 time at a turn) and I was only rotating them once. That was a missing link :), thanks.

No problem ! Good luck with the rest of the problem