The Descent

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:
max = 0
imax = 0
for i in range(8):
mountain_h = int(input()) # represents the height of one mountain.
if mountain_h > max:
max = mountain_h
imax = 8
end if mountain_h < max

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

# The index of the mountain to fire on.
end for 

I have this code. Before all this i just had the print (“0”) through print (“7”) and that way i just cleared the first test case. But for the second test case i couldn’t start on it, so tried end statements. It only got more complicated from there. I don’t know if i should just keep the print 0 - 7 to clear the objects. My only problem is looping in general.

A post was merged into an existing topic: The Descent - Puzzle discussion