Created
December 12, 2016 16:17
-
-
Save deadkff01/5350a2dbfda21b4d85dd0df9060bb758 to your computer and use it in GitHub Desktop.
The Descent - Solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// game loop | |
while (true) { | |
var largestMontain = 0; | |
var indexToShot = 0; | |
for (var i = 0; i < 8; i++) { | |
var mountainH = parseInt(readline()); // represents the height of one mountain. | |
if(largestMontain < mountainH) { | |
largestMontain = mountainH; | |
indexToShot = i; | |
} | |
} | |
// Write an action using print() | |
// To debug: printErr('Debug messages...'); | |
print(indexToShot); // The index of the mountain to fire on. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment