The Descent - Puzzle discussion


mountainheight = 0
mountainselected = 0
while True:
for i in range (8):
mountain_h = int(input())
if mountain_h > mountainheight:
mountainheight = mountain_h “”“repeats over and over so it doesn’t shoot a lower mountainheight”""
mountainselected = i #command to fire at mountain
#it took me a while to understand it too but clue was mountains always go from 0 to 7 never out of order


remove your “if” statement and make “else” your if


Here’s a hint:
You have to make the mountain with higher height destroy first. Even after a loop it has to skip a lower height mountain “if _____ > input:”
This is my hint to you.


All the playtests work, then I click on submit and the last case doesn’t work. Don’t change a line of code, resubmit and all is fine? What kind of fuckery is this? If its not going to work, why not point out where it failed (which it shouldn’t have)? This is the first “puzzle” I get after some copy and paste test and it doesn’t even work right.


I’m having a lot of trouble understanding this puzzle. What’s making it impossible is that I don’t know where my inputs are coming from. We’re given:
mountain_h = int(input()) # represents the height of one mountain.
And as I understand it, that is going to read down the line 0:9, 1:8 and so on. In a normal situation, I’d parse the code to find the highest number and boom - that’s it.

But since we can’t see where input are coming from, I don’t get how this works. =(


your inputs are read in a loop. that’s why the code stub gives you a while (true) or equivalent in whatever language…

think of it as a turn based game.
each turn (i.e. each iteration of the outer loop) you read 8 integers.
each of those 8 numbers is the height of a mountain.
after that you need to tell (output) which mountain to shoot at.

maybe the stub is confusing? the code given as a default does NOT give you a data structure! it just parses the input… so the default code will read all of those 8 numbers into the same variable… overwriting itself constantly…

it is your task to find a way to store the input and do some magic with them :slight_smile:

my standard first approach to all puzzles is outputting the input
put a print statement (to stderr) after each variable you read… just to see what kind of data you’re dealing with… i ran into the same problem several times: i tried to understand the input without seeing it. always a mistake :wink:


The Java solution code is not working. Please let me know if it works for you.


Just tested it, works 100% in Testcases and Validators.

maybe some cut’n’paste error?
Where does it fail for you?


should work. The space and the new-line bother.


I am having the same issue. Any word on whether it will be fixed?


There is nothing wrong with the Java solution code. You actually solved the puzzle with the same code.

What issue did you originally have?