Don't Panic - Episode 1 - Puzzle discussion


#107

Hey
I can't pass the first validation test.
Either the clone got destroy either it is blocked on the generator so no other clone can spawn .... i don't get it ...
Can someone explain me ?

Edit :
ok, nevermind the problem was this rule :

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.


#110

I'm using Python3 and having the same issue. There is something that i'm not understanding about how to reference the relevant elevator_pos value. I tried this for getting the direction but it gave an error:
if clone_pos < elevator_pos[elevator_floor.index(clone_floor)]:
elevatorDir = 'RIGHT'
else:
elevatorDir = 'LEFT'


#111

Hello, I always have an error with the "U Turn" test after submitting my response. The error is "Timeout: the program did not provide 1 input lines in due time...", but I've already added a output "WAIT" when the only head is blocked. Can someone help? Thanks


#112

Timeout means one of three things.
1) You took too long to think about the answer (generally this means > 100ms)
2) Your program crashed. Millions of ways for this to happen.
3) You didn't give an answer. Example in pseudocode:

if value < 3 then answer = 1
if value > 3 then answer = 2
value turns out to be 3, no answer is given.

One of those things is probably true in your code.


#113

I solved the problem, thank you.


#114

Thanks for info - helped me to solve :wink:


#115

The animation and the layout were cool. Fun visuals


#116

Anyone an idea what caused it/ how to fix it? Didn’t change anything from the input lines.
Standard Error Stream:

Exception in thread "main" java.util.InputMismatchException

at java.util.Scanner.throwFor on line 864

at java.util.Scanner.next on line 1485

at java.util.Scanner.nextInt on line 2117

at java.util.Scanner.nextInt on line 2076

at Player.main on line 32'

#117

Yes you did :stuck_out_tongue:

Here’s the part you changed:

for (int i = 0; i < nbElevators; i++) {
      int elevatorFloor = in.nextInt(); // floor on which this elevator is found
      int elevatorPos = in.nextInt(); // position of the elevator on its floor
 }

#118

How is it possible to pass test 06 called Few Rounds? It seems impossible to me.


#119

seems you managed to pass it.


#120

The puzzle is bugged as hell. Reading clonePos gives a 0 all the time in C, which makes the puzzle impossible to solve.

EDIT : Alright my bad, I changed the size of the direction array and that totally messed up the scanf.


#121

Why at one point the list can be read and another moment not?

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Player
{
    static void Main(string[] args)
    {
        List<int> integerList = new List<int>();
        string valeur = "";
        string[] inputs;
        inputs = Console.ReadLine().Split(' ');
        int nbFloors = int.Parse(inputs[0]); // number of floors
        int width = int.Parse(inputs[1]); // width of the area
        int nbRounds = int.Parse(inputs[2]); // maximum number of rounds
        int exitFloor = int.Parse(inputs[3]); // floor on which the exit is found
        int exitPos = int.Parse(inputs[4]); // position of the exit on its floor
        int nbTotalClones = int.Parse(inputs[5]); // number of generated clones
        int nbAdditionalElevators = int.Parse(inputs[6]); // ignore (always zero)
        int nbElevators = int.Parse(inputs[7]); // number of elevators
        for (int i = 0; i < nbElevators; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            int elevatorFloor = int.Parse(inputs[0]); // floor on which this elevator is found
            int elevatorPos = int.Parse(inputs[1]); // position of the elevator on its floor
            integerList.Add(elevatorPos);
        }

        // game loop
        while (true)
        {
            inputs = Console.ReadLine().Split(' ');
            int cloneFloor = int.Parse(inputs[0]); // floor of the leading clone
            int clonePos = int.Parse(inputs[1]); // position of the leading clone on its floor
            string direction = inputs[2]; // direction of the leading clone: LEFT or RIGHT

            // Write an action using Console.WriteLine()
            // To debug: Console.Error.WriteLine("Debug messages...");
            if(cloneFloor == exitFloor)
            {
                if( ( exitPos < clonePos && direction == "RIGHT" ) || ( exitPos > clonePos && direction == "LEFT" ) )
                {
                    valeur = "BLOCK";
                }
                else
                {
                    valeur = "WAIT";
                }
            }
            else
            {
                
                
                if( ( integerList[cloneFloor] < clonePos && direction == "RIGHT" ) || ( integerList[cloneFloor] > clonePos && direction == "LEFT" ) )
                {
                    valeur = "BLOCK";
                }
                else
                {
                    valeur = "WAIT";
                }
            }

            Console.WriteLine(valeur); // action: WAIT or BLOCK
        }
    }
}

#122

you might want to be a bit more explicit if you want someone to help you.