Onboarding - Puzzle discussion

obviously, if you use “print” for output, then you should remove line with “echo”

yes…obviously…thanks for your help! hows this

$hit = $enemy1;
if($dist1 > $dist2){
$hit = $enemy2;
}
echo($hit."\n");

The bash version seems to be broken.
We can only hit 2 of 4 tests.

c and python versions are working correctly.

bash version is ok, i had just checked it - so look for your errors

Yes, and every other languages.

I am having trouble in python - I can’t seem to make the code take the the names of approaching ships as inputs, meaning that my output is coming up as “Nobody”. At the moment I’ve kept the sample code of enemy1 = raw_input() etc. I’ve read all the way through this forum and done some googling but am still stuck. Any help would be greatly appreciated!

You need to store, each time in the loop, the enemies’ names (strings) and their distance (integers).

I am not terrible at JavaScript but not great. I am very used to using console.log() instead of print() in Web dev. As far as I know, that’s the recommended way to output strings to the console. Any reason why we’re using “Print” instead of “console.log” in this version? The code doesn’t even work with console.log().

I eventually got it to work! Thank you so much for replying and sorry for time wasting x

Finished this level with all the languages. It was great to have a first overview to all of them (At least for the print and ternary commands to all of them).

1 Like

The tutorial isn’t as great as the websites’ idea, and completely lacks the ability to teach someone with no experience. I’m confused as to how you might go about bringing the code into the game. Help is greatly appreciated.

I think the following FAQ can answer your question.

https://www.codingame.com/forum/t/faq-really-frequently-asked-questions/409

You basically need to print your answer in the console and the game will use that as input. Most of the code is already there so in this game you need only to use the IF ELSE statement and the print command for output.

I need a help with PHP code, I finish first 2 test cases but in 3rd it is searching names of enemys in my first 2 test cases and than I fail,how can I fix that, http://pastebin.com/vXhj5fAa

!! extreme hardcode !!!
main your goal is not just output enemy names in correct order
it is to determine name of the closest enemy and only then output it
you are given two pairs of data, that means you are given two enemies on every step, and about every enemy given you know it’s name and distance to it
so you can not just hardcode 16 or more steps forward, you need to read all the given data, compare distances on every step

i want a demo before i use this website

what is the code for tutorial example? any one please help me.

Do you want the solution?

anyone close my eyes, i don’t want to see this anymore

can i get the code for some initial puzzles coz i don’t know how write in this IDE

NO idea how to do first test thing on Java