# Don't Panic - Episode 1 - Puzzle discussion

I’ve PMed you just now. You may try sending your code to me there.

should I read the elevatorPos in C# in order to compare the clonePos witht the elevatorPos im stocked i only complete till the 3rd round, if if i need read the elevatorPos, how can i do it ?

All elevator positions are provided at the beginning. You have to store them then, otherwise you won’t have access to those values when the clones start coming in.

Please refer to the default code on how to read those values.

1 Like

im not able to read the elevatorPos on each floor, i dont know what happened, does not differenciate the floors between eachother.

i just solve it, my God y almost cry

hello I just have a little problem with my code (python 3) it works well until test 3 and after it does not respond fast enough

if direction == "NONE":
print("WAIT")
else:
if exit_floor == clone_floor:
if exit_pos < clone_pos and direction == "RIGHT":
print("BLOCK")
elif exit_pos > clone_pos and direction == "LEFT":
print("BLOCK")
else:
print("WAIT")
elif elevator_floor == clone_floor:
if elevator_pos < clone_pos and direction == "RIGHT":
print("BLOCK")
elif elevator_pos > clone_pos and direction == "LEFT":
print("BLOCK")
else:
print("WAIT")

he don’t find a value for elevator_floor and elevator_pos (reportUnboundVariable)

It’s not an issue of your code not responding fast enough. Those are just a few lines of code. The timeout message also appears, in general, if your code doesn’t output anything before the next round begins.

Another question to think about is: What if direction ≠ “NONE” and exit_floor ≠ clone_floor and elevator_floor ≠ clone_floor? Your code won’t output anything under such a situation.

1 Like

Sorry but in starting to answer I got confused with how could I get data about the elevator in the game loop. Can I have some help, please ?

Same issue for me (though I didn’t use these values beforehand)

Please refer to the starting default code that you have. Using that code you can read the initial elevator information and the data every turn. You then need to add your own code to it to store and process the data and print outputs.

Hello,
I wrote the first part of my code that allowed me to pass the first step (when the clone starts at the exit floor)

if direction == "RIGHT":
if clone_pos > exit_pos:
print("BLOCK")
else:
print("WAIT")
else:
if clone_pos < exit_pos:
print("BLOCK")
else:
print("WAIT")'

So I tried to add the condition
if clone_floor==exit_floor:
before my code without changing anything else, and I don’t understand why my code doesn’t work anymore (even for the firest test) since I only add a condition that is always verified.

I am a bit stuck and don’t know what’s wrong.
While it should be straight forward I just cannot get my head around this:

As can be seen in the image, my second clone goes up and it literally says floor 1, and exitPos 12… but… it’s not on position 12 on floor 1, it’s on position 10, so the if statement obviously fails and a lot of unexpected clones pile up over there. Is this a bug or does it have something to do with the order in which clones are being put on the board?

When in a round there are no clones, clone_floor = -1 ≠ exit_floor. If your code does not handle such a situation, then your code may not output anything for that round.

Would you please share the link to that replay (use the button at the bottom of the viewer to get the link)?

Hello 5DN1L,

Hereby the link: Game Replay - CodinGame

Ok thanks, I didn’t think of it that way.
I also wonder if it’s possible when i’m stuck to be able to see the values of each of my variables at a specific step, to understand why my code doesn’t work as I thought it would be ?

You can always add debug statements to print out the values of any variables at any point in your code, e.g. in Python:

print(clone_floor, exit_floor, file=sys.stderr, flush=True)

I watched the replay. The debug statements are correct. Note that the leader is the clone with the pink line, not the red line. In the screenshot you posted earlier, the “pink clone” is at position 12 just taking the elevator on floor 0 (turn 07/53), and in the next turn, it reaches position 12 on floor 1 (turn 08/53).

That worked, thanks a lot.
I thought i coudn’t print things as it could cause problemes with the “wait” and “block” prints that are waited by the game.

Hello 5DN1L,

Thanks for coming back at me.

I know understood what I did wrong.
I should have stored the elevator floors and positions and compare the leader clonePos with the current leader floors’ elevator position.

It should be fine now.
Thank you.