Onboarding - Puzzle discussion


#152

i am a complete noob in terms of programming. i am trying to teach myself some php and am flailing. please tell me whats wrong with this code

NO FULL CODE

this is the error I’m getting
Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in the answer code
at line 28
any help/criticism is great appreciated


#153

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


#154

yes…obviously…thanks for your help! hows this

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


#155

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

c and python versions are working correctly.


#156

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


#157

Yes, and every other languages.


#158

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!


#159

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


#160

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().


#161

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


#162

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).


#163

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.


#164

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.


#165

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


#166

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


#167

i want a demo before i use this website


#168

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


#169

Do you want the solution?


#170

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


#171

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