hs2048-0.1.0: A 2048 clone in Haskell.

Safe HaskellSafe-Inferred



Main entry point for the console interface to the game.



direction :: String -> Maybe DirectionSource

Converts a string into a direction.

>>> direction "\ESC[D"
Just West
>>> direction "<"

getChars :: IO (Maybe String)Source

Gets up to three characters from standard input. If the input corresponds to an arrow key, it will be returned. Otherwise Nothing will be returned. Will only consume enough input to determine if the input is an arrow key or not.

getMove :: IO (Maybe Direction)Source

Reads from standard input and converts it into a direction. See getChars.

play :: RandomGen r => (Board, r) -> IO ()Source

Plays the game.