The Descent - Puzzle discussion

Why did I get the same array back after I shot down a whole mountain then. During the first test case using py3.

At each turn you get the updated heights of mountains.
No problem on it (457226 coders solved)

The problem should be in your code …

kinda new to progaming, gave up after some time on freecodecamp and came here: I had no idea what I was even supposed to be doing in puzzle 1 so I looked at the solution. The Onboarding was “Copy and Paste this code” then the first puzzle expects me to declare variables, use an if-statement and more … I fail to understand what this site does. Do I already have to know programing before continuing here?

1 Like

You need to know the basics : if statements, for/while loops, and variables. This site can be seen as a training area, a way to practice what you’ve learned. If you’re not there yet, you should first follow a tutorial for the language you’re interested in.

2 Likes

Hi i am a beginner at java too. Actually i had the same problem as you. I was hoping we could solve the problem together.

I’m very new to coding. I followed along with a video that someone posted, since I couldn’t figure out the solution (this video: https://www.youtube.com/watch?v=t-tPMY9wdE8), but I did mine in C++. I can’t figure out why it’s not working, but no matter what I do I’ve been getting the error “Invalid command sent. It should be an integer from 0 to 7.” I took screenshots of the code and of the error I got, but I guess since I’m new, I can’t upload the images. Anyway, any help would be greatly appreciated. Thank you. :slight_smile:

1 Like

not sure how we can help you except by telling you to output an integer between 0 and 7

That task are tough for Newbies. It must be define step by step in such task to understand the clear concept .

1 Like

worst first game ever :smiley: totally unintuitive. hackerrank is better :slight_smile:

Yeah ! Totally agree with you ! You’ll be happy on hackerrank ! Farewell !

yeah, good idea, best regards for all!

It’s not the first one. :expressionless:

My code passes the first two tests, but not the third and I’m not sure why?

// game loop

let map = new Map();

while (true) {

    for (let i = 0; i < 8; i++) {

        const mountainH = parseInt(readline()); // represents the height of one mountain.

        map.set(i, mountainH);

    }

    const mapSort1 = new Map([...map.entries()].sort((a, b) => b[1] - a[1]));

    for (let index of mapSort1.keys()) {

        console.log(index); 
    }
}

You are not outputting the answer correctly

By the end of the game turn, you must fire on the highest mountain by outputting its index (from 0 to 7).

Your code is outputting several values for a single turn (conole.log() in a loop)

1 Like

Absolutely.
What is this?

Simplicity and clear logic. Starting from requirement(s).
Is this showing off everything than real coding and logic?!

i dont understand coding i am new and i want to learn but i dont understand so i am not getting any progresjon i have tryed this for a week but i cant understand

https://www.codingame.com/forum/t/beginner-coding/1926

You don’t have to be a good programmer, but you do need to know some basic stuff before this site makes sense.

To do the Easy section of the Training area, you need to know comparisons, arrays, and loops. IIRC one of them almost forces you to use a Dictionary/Hashmap (which is trivial in C# or JS). Knowing a bit about working with strings is helpful. If you don’t know that stuff yet, I’d recommend spending some time on Codecademy or any of the multitude of tutorial websites out there before you tried the puzzles here.

I was confused because i thought i need to write the code to destroy the mountains too (reduce the highest mountain to 0). Did I miss the question in some way?

Welcome to Codingame!

It would help if you described the exact problem you are having. Without that I can only guess at what the issue might be. However, I will say that outside of basic syntax and logic errors, the most common mistake people make is outputting the height of the mountain they’re firing at rather than its index.

One thing that is not obvious at the beginning is that there is a very detailed problem statement available. This includes the format of the inputs you’ll be given, what they all mean, and what your outputs are supposed to look like. Just scroll down inside the panel with the graphics and it’ll tell you what you’re supposed to do.

1 Like

I’m not a smart person, but can anyone explain to me in simple way what’s stdin and how it relates to the game?
And also…
for i in range(8):
mountain_h = int(input())

what is the value in ‘i’? (is ‘i’ our plane?)
i might be wrong but doesn’t input() , means for the user to input the variable?

Please advice. I’m confused how to even start playing these game