Skip to content

Instantly share code, notes, and snippets.

@dukeimg
Created April 22, 2016 03:48
Show Gist options
  • Save dukeimg/cdc8bb1f6d3c1769a908d41c00a6e868 to your computer and use it in GitHub Desktop.
Save dukeimg/cdc8bb1f6d3c1769a908d41c00a6e868 to your computer and use it in GitHub Desktop.
The Descent
STDOUT.sync = true # DO NOT REMOVE
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
# game loop
loop do
highest = 0
index = 0
8.times do |n|
mountain_h = gets.to_i # represents the height of one mountain, from 9 to 0.
if mountain_h > highest
highest = mountain_h
index = n
end
end
# Write an action using puts
# To debug: STDERR.puts "Debug messages..."
puts index # The number of the mountain to fire on.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment