Onboarding - Puzzle discussion


#234

HELP! so I’m using java and/or java script and I can’t seem to get ether to work :frowning: If I need to compile the code I can’t find where to do that. this is what I have so far…

Java :

[EDIT: NO FULL CODE]

Javascript :

[EDIT: NO FULL CODE]


#237

Why are you writing this message thrice? 8-(
You should not write “enemy1” but his name.

[Edit: two of the three messages you mention were deleted]


#238

Hi, I can’t make it work, I am using PHP, and I feel like I miss something.

I am at level 1 -_-. Here is the entire code:

[EDIT: NO FULL CODE]

But when I debug $enemy1 and $enemy2, it just shows Nobody. Anyway, as far as I understand, the fscanf should ask something in the console? Because it doesn’t…

I feel like a miss a big thing right in front of my nose, like a button or something…

Thanks for your help!


#239

Try to explain your problem without writing your full code. You can give a piece of your code though, but limited to your problem.

By the way, try to debug with what you are writing in the standard output. You will not only see “Nobody”.


#240

@yohannjardin I think for the easy problems you should allow posting the full code. A typical Beginner doesn’t know enough to articulate a meaningful question. Besides, an easy problem is only 50CP. On the Codingame blog there is the full code for at least one very hard game worth 500CP.


#241

You’re right, saying beginners may not be able to explain their problems in a clear and brief way, but it is possible to help them doing so.

There are multiple issue in letting people display their full solutions (unfortunately, some are internal reason :frowning: ).
However, we are constantly working on improving the platform to avoid people being frustrating because they do not understand what is wrong. We are also working on some cool features that will help beginners on easy puzzles to better understand how everything works. You can except some of them to be released soon :slight_smile:

P.S. When messages are more like ‘here is my code, help me’, I give some hint (like my previous message).


#242

Hi I’m sorry, I didn’t ment to offend you, but I thought I understood the code, that’s why I posted it entirely if I just didn’t see something.

However, I am going to explain my code (mostly generated by codingame platform:

  1. First, the program use the [fscanf][1] function, I thought that this was the inputs of the game, so that this line of code would do something like:
fscanf(STDIN, "%s",
    $enemy1 // name of enemy 1
);
echo $enemy1; //Should print something like "Buzz"

But the fact is that $enemy1 turns out to be Nobody
What do I miss? Thanks a lot for your help :blush:
[1]: http://php.net/manual/fr/function.fscanf.php


#243

@marteau_mathieu “Nobody” is the right output, but you also have to print a newline with echo "\n"; to flush the stream.

@yohannjardin I just noticed that the IDE isn’t very clear when you forget the newline. Here is a picture.


#244

@marteau_mathieu I do not think you offend anyone :slight_smile:

Your code contained echo $enemy1 . '\n' when you posted it. If you outpout that, you will see Nobody\n. To use the \n as a newline, you must put it between double quote instead of single quote, as @chrm showed you :wink:

That’s because single quotes are used for plain text that will not be evaluated. You can check the difference using echo '$enemy1\n'; and echo "$enemy1\n";

@chrm What is written to standard-out is the stream of characters receive. So ‘Nobody’ was effectively sent, but without newline we cannot be sure that is all the user wants to write on the line.

The error message is not clear about that point.


#245

It will be Great if this used to be a OFFLINE SOFTWARE rather than being a online website. (y)


#247

Hi there i am stuck in first task. I do not know how to make universal code for this onboarding game. I need to print out the name of closest enemy. I noticed four variables but i do not know how to put the name and distance of my enemy in those variables. Could you help me. I am new to this coding staff.


#248

The code provided stores the distances and names into the variables. Your job is to write the correct if to select which variable to print.


#249

Hi! I get a weird bug where the game is not shown, it gets stuck at 98 and that´s about it. Any suggestions? (tried on chrome and firefox, same deal)


#250

My viewer is blank. Just a dark grey background with a big “94” at the bottom right, like maybe it’s stuck at 94%. Am I missing something?


#251

@elrikcosta @drew_mcdowell do you still have this issue?


#252

Nope, working now, thanks.


#253

I still have it on my main pc but it works fine on the laptop. It only applies on the tutorial that i already solved so…


#254

Maybe you haven’t refreshed the page? I’d be interested by the error message you should be able to see in the console (F12 on chrome/firefox).


#255

I get the same error using Perl. It’s only doing 2 steps and thinks it’s done. Using java, it managed to shoot everyone in the 11 steps.


#256

Can someone help me? I can’t figure out the tutorial, I’ve tried a lot of things. It gives me the error “Timeout: your program did not provide an input in due time.” What can I do?