Skip to content

Instantly share code, notes, and snippets.

@daiksy
Last active August 29, 2015 14:07
Show Gist options
  • Save daiksy/d2fadf8ffffc0024e31b to your computer and use it in GitHub Desktop.
Save daiksy/d2fadf8ffffc0024e31b to your computer and use it in GitHub Desktop.
CodingGame Puzzle - Kirk's Quest - The Descent
import math._
import scala.util._
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
object Player {
def main(args: Array[String]) {
// game loop
while(true) {
val Array(sx, sy) = for(i <- readLine split " ") yield i.toInt
val mountains = {
for{
i <- 0 until 8
mh = readInt
} yield(i -> mh)
}.sortBy(_._2).reverse
Console.err.println(s"sx: $sx, sy:$sy")
Console.err.println(s"mountains: $mountains")
mountains.head match {
case m if sx == m._1 && m._2 != 0 => println("FIRE")
case _ => println("HOLD")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment