Hi martixana, it’s normal to be a bit frustrated at the beginning and it’s very good that you’re sharing that and seeking advise.
So, the main idea for platforms like CodinGame is to solve programming puzzles, tasks that will exercise your logical/algorithmic thinking and your programming skills in your language of choice. These tasks are so called input-output, which means that after you write your program it’s ran on a machine(server) which gives it specific input usually in the form of a text file. These tasks won’t tell you to implement an online store for example, but they’ll help you sharpen your general programming skills which could be adopted in any software development area afterwards. Image it as if you’re solving the problems from your math books back in school.
So, when you’re reading data from the standard input(using “readline()” in JavaScript) you are actually reading the data from that text file. After you have stored the input data, you have to use it to solve the given task and then output the result on the standard output(using “console.log(res)” in JavaScript)
For example let’s say that you’re given a task to read 2 numbers, add them and output their sum.
Each Test Case for the task is a text file with 2 numbers on separate lines, one of them could be:
01_Test_Case.txt:
4
8
When you run your program it’s given that txt file, you could imagine it like your program is like a function with an argument the txt file:
martixanaAddingProgram(“01_Test_Case.txt”)
Inside your program you must gather and store the contents(which is done by default for every puzzle) in this case you’re given 2 numbers on separate lines:
var n0 = parseInt(readline());
var n1 = parseInt(readline());
Now that you have the input data for the problem you must use it. In this case you must add the given numbers, so you could create a third variable called res, which will store the result
var res = n0 + n1;
After that you have the answer you have to output it, in the case of JavaScript, using console.log:
console.log(res)
After that the machine on which your program is run will get your output result and check if its correct(it has the correct answers for each test txt file) and report back to you.
I think the Mars Lander puzzle is a bit difficult to start out with(because it has many inputs).
I made for you a couple of almost trivial puzzles to solve so you could exercise what I talked above:
Add 3 numbers
You have to read 3 numbers and output their sum:
Output stars
You have to read a number and output that many “*” symbols on one line. You could use a loop or the repeat function for strings.
(I hope that the links are working)
Other than that I could suggest this tutorial which has similar “trivial” input-output tasks, but it’s payed.
Also you could think of different task by yourself, print your name in reverse, calculate a person’s age by given the date of birth,…
After you mastered the “trivial” tasks you could try solving The Descent puzzle on CodinGame
This dude has a very good introduction video about competitive programming as a whole.
I hope that I’ve helped you to clarify the things a bit more, ask if there is something else.
Have fun