The Last Crusade - Episode 2 - Puzzle discussion


#1

Feel free to send your feedback or ask some help here!




#2

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

#3

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 ?


#4

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


#5

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


#6

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


#7

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


#8

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 wink


#9

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


#10

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


#11

Thanks Dan, this will help me. Mc


#12

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?


#13

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,
Gennady


#14

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.


#15

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?


#16

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 wink


#17

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.


#18

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


#19

"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 smile, thanks.


#20

No problem ! Good luck with the rest of the problem smile