The Descent - Puzzle discussion


#340

you need to be a bit more explicit, else you probably won’t get much help.

First, you can read a bit of history in this thread, it should answer most of your questions. Then, you can tell us what you tried and what is blocking you.


#341

Hi. Yes, I understand that part now, finally, but that was not clear here:

At the start of each game turn , you are given the height of the 8 mountains from left to right.
By the end of the game turn , you must fire on the highest mountain by outputting its index (from 0 to >7)

The next issue is that it’s unclear to me how they are “given to me” – I can easily modify that for loop that counts from 0 to 7 and put in something silly, like for(int i=-8; i < 0; i++) and the code will still run. Yet clearly that for loop index isn’t what is defining the indices.

Then there’s this:

  • The while loop represents the game.

How? A while(true) loop, in a real coding environment, would crash your system if you aren’t putting a WaitForSeconds call in there or something as part of a coroutine.

  • Each iteration represents a turn of the game
    I don’t know what “turn of the game” means. When the ship flies from left to right? When it flies from left to right and back, making a round trip?

Just giving some ideas as to why this simple puzzle only has a 55% success rate. Maybe it’s a kind of “native English speakers have more trouble with Shakespeare than non-native speakers” situation, but I still think this will confuse a percentage of new coders and/or give them the wrong idea in the long run if they think while loops are this slow.


#342

Try this. Scroll down from the graphics pane where the ship and mountains are. Underneath that is a detailed problem description that answers just about all the questions you’ve asked. On some puzzles it’s not at all obvious that there is more on that pane.

The old hands take it for granted now but I remember having the same complaints in the beginning before I discovered that fact. CG probably ought to look into that on this puzzle in particular since like he said, it probably pushes some beginners to give up too early.


#343

Arrg I will look for that, thanks.

FWIW, myself and the rest of the dev team where I work complain about similar tutorial designs for our own projects all the time, along the veins of “Nobody is going to see/read/get this, boss…”


#344

Hi there!

I’m really new to Codin’ Games and just completed a game but when I went to The Descent I was so puzzled.

This is the code:

    import sys
import math

# The while loop represents the game.
# Each iteration represents a turn of the game
# where you are given inputs (the heights of the mountains)
# and where you have to print an output (the index of the mountain to fire on)
# The inputs you are given are automatically updated according to your last actions.


# game loop
while True:
    for i in range(8):
        mountain_h = int(input())  # represents the height of one mountain.

    # Write an action using print
    print("I will destroy you!")
    # To debug: print("Debug messages...", file=sys.stderr)

    # The index of the mountain to fire on.
    print("4")

Could someone help please?

  • Zoe

#345

welcome @TheFirefly, see my answer five posts above.


#346

Hey there,
I am new to this platform and I can’t understand what’s wrong with my code (like a lot of persons here!). I am using PHP, here it is :

while (TRUE)
{
    $mountainsH = [];
    for ($i = 0; $i < 8; $i++)
    {
        fscanf(STDIN, "%d",
            $mountainH // represents the height of one mountain.
        );
        array_push($mountainsH,$mountainH);
    }
    $val = max($mountainsH);
    $highest = array_search($val,$mountainsH);
    echo($highest."\n");
}

I have this infos in the console :

Informations :

Let’s destroy those mountains to secure our landing…
Height of mountain 0 : 0 Height of mountain 1 : 0 Height of mountain 2 : 0 Height of mountain 3 : 8 Height of mountain 4 : 0 Height of mountain 5 : 0 Height of mountain 6 : 0 Height of mountain 7 : 0

Sortie standard : 3

Informations : Invalid command sent. It should be an integer from 0 to 7.

Height of mountain 0 : 0 Height of mountain 1 : 0 Height of mountain 2 : 0 Height of mountain 3 : 8 Height of mountain 4 : 0 Height of mountain 5 : 0 Height of mountain 6 : 0 Height of mountain 7 : 0

I get that the loop does not carry on. I don’t understand why.
Any help will be appreciated !
Thanks


#347

Hello

It is very strange :neutral_face:
I tried with your code and it works perfectly