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.
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ā¦
Hi @snara !
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 ā¦ bye !
Hi @eden.adamson : Welcome to the Forum !
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 !
You can talk about easy (or medium) puzzles, ClashOfCode, EscapeGames and the next CodinGame Fall Challenge ā¦ maybe nearly about October or November ā¦
Have sun, fun, and Coding pleasures @ CodinGame ā¦
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);