Onboarding - Puzzle discussion

Itā€™s just a tutorial to show what an actual puzzle looks like. Thereā€™s nothing to do, just copy/paste the given code.

A puzzle would usually look like this : you are given inputs (the part of the code that manages these inputs will be written already, do not touch it at first - you can do it later when youā€™re more familiar with it).
Then you have to perform a task with these inputs and output something.

Sometimes you have to get inputs and output something only once, sometimes you will have to repeat the process (in this case the whole input/output thing is made in an infinite loop that will be coded alreay, do not touch it either).

Donā€™t worry about the loop being seemingly infinite, your output is actually given to a ā€œrefereeā€ that will stop it when it considers that the puzzle is over.

1 Like

i am new wit code i yous c++ i now not 1 tig i bout code

Groovy often ends up in timeout with the code providedā€¦
any way to fix it?

ps: using ternary operator seems to have made it faster.

    println dist1 < dist2 ? enemy1 : enemy2
1 Like

when I played this with Dart, this provided code did not work.

    String enemy1 = stdin.readLineSync();
    int dist1 = int.parse(stdin.readLineSync());
    String enemy2 = stdin.readLineSync();
    int dist2 = int.parse(stdin.readLineSync());

error output:

Answer.dart:7:27: Error: A value of type ā€˜String?ā€™ canā€™t be assigned to a variable of type ā€˜Stringā€™ because ā€˜String?ā€™ is nullable and ā€˜Stringā€™ isnā€™t.
String enemy1 = stdin.readLineSync();

adding a ! (null check) after the readLineSync() solved the issue:

    String enemy1 = stdin.readLineSync()!; 
    int dist1 = int.parse(stdin.readLineSync()!); 
    String enemy2 = stdin.readLineSync()!; 
    int dist2 = int.parse(stdin.readLineSync()!); 

or, pressing the ā€œResetā€ button and then replacing the output would work, too.
could you fix it? I think itā€™s hard for the beginners to find outā€¦

2 Likes

hey is there a way for me to code my own game.

Hi @snara :slight_smile: !
As i said in another topic (Groovy gets timeouts in every clash now - #17 by Jp82),
ā†’ Groovy now works for me in both IDE and Validators ā€¦
=> maybe you can retry now your submissions and get Validators succeed ?
Have fun with Groovy too :wink: ā€¦ bye !

add begginer courses because i want to reccomend this to my class but they dont know anyhing about coding unless its coding with blocks.

:wave: Hi @eden.adamson : Welcome to the Forum :clap: :smiley: !
CodinGame is a wonderful site for programmers, beginning or more experienced ā€¦
ā†’ If you go in the Menu to ā€œActivities ā†’ Learnā€, you can access to a wide variety of tuto in all the languages supported by CodinGame, on many topics, about any specific, etcā€¦
ā†’ With an account in CodinGame, you can (freely) access to the https://tech.io/ platform, dedicated to share help between more experienced programmers and beginners :
=> iā€™m sure all your schoolā€™ friends will find an interesting subject or raison to learn Programming :wink: !

You can talk about easy (or medium) puzzles, ClashOfCode, EscapeGames and the next CodinGame Fall Challenge ā€¦ maybe nearly about October or November ā€¦

Have :sun_with_face: sun, :bulb: fun, and :hugs: Coding pleasures @ CodinGame :wink: ā€¦

all test cases are passed , but i donā€™t understand fast chaning array, iā€™m using python can somone please help me this is my code

[No full source code, please]

Fast changing list

here is the link for game : Coding Games and Programming Challenges to Code Better

You canā€™t shoot two enemies at the same time, see ā€œoutput the value of either enemy1 or enemy2ā€ in the statement.

2 Likes

I encountered the same issue - my solution was to cast the
nullable String? as String:

    String enemy1 = stdin.readLineSync() as String; 
    int dist1 = int.parse(stdin.readLineSync() as String); 
    String enemy2 = stdin.readLineSync() as String; 
    int dist2 = int.parse(stdin.readLineSync() as String); 

hi i need to the the coding language may you help me with that email me at [nope] thx

[please ask your questions here]

sorry canā€™t help just started coding

well try west to right

Hi guys iā€™m just new and am a programmer take care of me.

1 Like

I need help with putting in the codes.

hi
so today i have giveawy not rn just tipying bc it say i can but yes i will, be haveing one

hi i really donā€™t get some of this

please help me to learn coarding

1 Like

Hello person Idk you but hello!>