Don't Panic - Episode 1 - Puzzle discussion

Hello,

Should be really straight forward, however I cannot understand why I cannot get the easy ones to work, while the difficult ones succeed. 1,3,5 not working
e.g. works:
Spaced elevators, few rounds
e.g. does not work.
U Turn

How can I manage turns for this challenge? Seems there are no clones available in time.

As written in the puzzle statement:

If there is no leading clone, the line values are: -1 -1 NONE. This can happen only when the clones which are already outside are all blocked and the next clone is not out yet. In this case, you may output action WAIT.

Hello 5DN1L,

As per my code

//corner case that was mentioned. Leave as is.
if(cloneFloor == -1 && clonePos == -1 && direction=="NONE")
{
  Console.Error.WriteLine("Waiting for a clone to appear");
  action = "WAIT";
}

Debug output:

### Standard Error Stream:

RIGHT Setting floor: 0 blockage at: 9

Clone blocked at 9

ACTION: BLOCK

### Game information:

You block one clone. Next leading clone coming in 2 turns.
### Game information:

Timeout: the program did not provide 1 input lines in due time... You block one clone. Next leading clone coming in 2 turns.

First part of the code;

//constraints
            if(clonePos > 0  &&  clonePos < width)
            {
                var elevatorOnFloor = floors[cloneFloor,0];
                //Console.Error.WriteLine($"This floor {(cloneFloor == exitFloor? exitFloor: cloneFloor)}: elevator position:{(cloneFloor == exitFloor?exitPos:elevatorOnFloor)}");
                var elevator = cloneFloor == exitFloor
                                                ?exitPos
                                                :elevatorOnFloor;

                message.Clear(); // reset each turn? is this one turn? while true..
                
                //corner case that was mentioned. Leave as is.
                if(cloneFloor == -1 && clonePos == -1 && direction=="NONE")
                {
                    Console.Error.WriteLine("Waiting for a clone to appear");
                    action = "WAIT";
                }

So you tell me… the other conditions won’t be fulfilled so I have to make the assumption that on the end it would do a:

Console.WriteLine(action);

Where action of course is “WAIT”.

If clonePos > 0, then clonePos cannot be == -1.

Ah yes… that’s true. Totally didn’t see it.
Solved it. Thanks for being my ‘duck’ to talk to.

One comment though; when running the tests one keeps failing. While I can see it succeeds if I run it individually.
So just decided to submit and than it’s a 100% (without achievement, so need to make better the code somehow)

I have a problerm it semmes in Javascript on the test case not working right:
Here my LOG:

Standard Error Stream:

cloneFloor: 3
clonePos: 6
floor to search: 3
position to search: 18
nearestElevatorPos: 18
block to LEFT
final operation: BLOCK

Standard Output Stream:

WAIT

Game information:

You do nothing.

The final operation: BLOCK is the log about the operation that i return in the console.log
But in the standar ouptut stream it continue to be WAIT.
The problem sems present only for the test case 5 for alla other test work fine

That means you have included different things in console.log and console.error. Either they are different variables or the same variable has been changed in between somehow.

Timeout: the program did not provide 1 input lines in due time…

Am I the only one with this problem?

Probably not, but the problem will be very likely caused by some issue in your code. Possible reasons:

  • Your code does not output anything before reading the next set of inputs.
  • Your code does not output within the permitted time limit, e.g. your code is stuck in an infinite loop or your code is not efficient enough.