Skip to content

Instantly share code, notes, and snippets.

@jkramer jkramer/chasm.hs
Created Jan 11, 2016

Embed
What would you like to do?
CodinGame - Chasm
import System.IO
import Control.Monad
main = do
hSetBuffering stdout NoBuffering -- DO NOT REMOVE
[road, gap, platform] <- replicateM 3 (fmap read getLine)
forever $ do
[speed, x] <- replicateM 2 (fmap read getLine)
putStrLn (command road gap platform speed x)
command road gap platform speed x
| x < road && speed < (gap + 1) = "SPEED"
| x < road && speed > (gap + 1) = "SLOW"
| x >= road = "SLOW"
| x + speed >= road = "JUMP"
| otherwise = "WAIT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.