hs2048-0.1.0: A 2048 clone in Haskell.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Hs2048.Main

Description

Main entry point for the console interface to the game.

Synopsis

Documentation

direction :: String -> Maybe Direction Source

Converts a string into a direction.

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

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.