# [Community Puzzle] Shoot Enemy Aircraft

Coding Games and Programming Challenges to Code Better

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âŠ?

could you explain the rules
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?!

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
then I think is need to describe more detailed this situation with launching and maybe provide some exampleâŠ

That was fun.

Thank you

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.

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

1 Like

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.
**/

for (let i = 0; i < n; i++) {
}

// 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

SHOOTEnd of line (\n)

Attendu :

Rien

``````

I use the proposed output function:

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