[Community Puzzle] Shoot Enemy Aircraft

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Remi,validated by @FredericLocquet,@Timinator and @McKael.
If you have any issues, feel free to ping them.

hi
could someone explain the rule pls
?

It’s Space invaders.

could you explain the rules
for example task 03
last two dots meaning no plane we should to wait 2 turn -ok
but at the begining of the string we have 4 dots - but only 1 wait. how?!

Hi, I hope this will help you.

Initial state :

...<<<<<<<<<<<<<<<<<<<<<<<..<<<
^______________________________

First turn : you wait

..<<<<<<<<<<<<<<<<<<<<<<<..<<<.
^______________________________

2nd turn : shoot

.<<<<<<<<<<<<<<<<<<<<<<<..<<<..
|______________________________

3rd turn

X<<<<<<<<<<<<<<<<<<<<<<..<<<...
^______________________________

thank you.
so in the description is incorrect ( little bit )
“Each turn your missiles move one cell up.”
as I understand when missile already in air then one cell up for one turn
but launching the missile is occupies 2 turn
[first turn arrow ^ just replacing by |]
[second turn its movies to one cell up]

ok. what is happening with missile when its meet plane ? is it goes to next line (up) ?

That’s why I wrote “Note: When you shoot, the missile appears at the same altitude as the launcher”.
But maybe you can tell me what I can write if it is not clear enough ?

The missile disappears but there is no case where you need the missile to shoot another aircraft (no need to shoot twice at the same turn).

it will be best if launching the missile and fly of missile will be identical (1 turn - 1 line) but might be this is unreal :slight_smile:
then I think is need to describe more detailed this situation with launching and maybe provide some example


That was fun. :slight_smile:

Thank you :slight_smile:

could someone explain to me how planes behave when they exit the screen. Since level 2 is impossible in 1 pass since all 3 planes stack over each other and you cant shoot 3 missiles at once

do they come back from the same side they came or do they turn around


>
 
>. 
> 
< 
<
 
<


Actually this case never appears, you can shoot each plane before it reaches the other side.

Hi, my solution passes all the test cases, but when I submit I fail the “Hold the line case”. I’m not sure how it differs from the corresponding test case, but it seems to be an edge case for my solution and I can’t figure out why.

2 Likes

In the validator the launcher is on the right of the grid (instead of the left in the test case).
You can try this custom test case :

2
>.>..
____^

Output : SHOOT WAIT SHOOT

3 Likes

Thanks, it seems the problem occurs when the gun is in the rightmost position.

Hi,

Your puzzle seems cool but I have an issue to print the value “WAIT” (it works with “SHOOT”).
I tried with different languages (Dart and after Javascript) and I have the same issue.

For example with this code (it’s the default one with the line console.log('SHOOT') commented) :

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/

const n = parseInt(readline());
for (let i = 0; i < n; i++) {
    const line = readline();
}

// Write an answer using console.log()
// To debug: console.error('Debug messages...');

//console.log('SHOOT');
console.log('WAIT');

I have the result "Failed. Found: nothing, Expected: “WAIT” ".

Do you have any idea of the problem ? Thanks !

Hi, you have to output several lines, until you shoot every aircraft. Your first line is WAIT but your 2nd line is nothing because you don’t output a second line.

Hello,

I have a little problem with my PHP output, everything is fine, I get the correct firing instructions, but there is a formatting error.

Sortie console
Sortie standard :

array (
  0 => '....................',
  1 => '.>..................',
  2 => '...................<',
  3 => '....................',
  4 => '....................',
  5 => '_________^__________',
)
WAIT
WAIT
WAIT
SHOOT
WAIT
WAIT
SHOOT

Échec
Trouvé :

SHOOTEnd of line (\n)

Attendu :

Rien


I use the proposed output function:

    {
        echo("SHOOT\n");
    } else {
        echo("WAIT\n");
    }

Thanks for your help :wink:

Maybe you printed an unexpected ‘\n’ (empty line after the last SHOOT)

Thanks, it was simply that :wink: