Last active
August 29, 2015 14:07
-
-
Save daiksy/d2fadf8ffffc0024e31b to your computer and use it in GitHub Desktop.
CodingGame Puzzle - Kirk's Quest - The Descent
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
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