| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Hs2048
Description
Top-level module. Re-exports things from all other modules.
Synopsis
- module Hs2048.Board
- module Hs2048.Game
- module Hs2048.Main
- module Hs2048.Point
- module Hs2048.Renderer
- module Hs2048.Settings
- data Direction
- type Tile = Maybe Int
- type Vector = [Tile]
- directions :: [Direction]
- rank :: Tile -> Int
- emptyIndexes :: Vector -> [Int]
Documentation
module Hs2048.Board
module Hs2048.Game
module Hs2048.Main
module Hs2048.Point
module Hs2048.Renderer
module Hs2048.Settings
Represents a direction that the game board can be moved in. The cardinal
directions are used to avoid collisions with Left and Right.
Instances
| Bounded Direction Source # | |
| Enum Direction Source # | |
Defined in Hs2048.Direction Methods succ :: Direction -> Direction # pred :: Direction -> Direction # fromEnum :: Direction -> Int # enumFrom :: Direction -> [Direction] # enumFromThen :: Direction -> Direction -> [Direction] # enumFromTo :: Direction -> Direction -> [Direction] # enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] # | |
| Show Direction Source # | |
| Eq Direction Source # | |
type Tile = Maybe Int Source #
Represents a tile on the game board. Can be empty (Nothing) or can have a
value (Just n). By convention, a tile's value is always a power of 2.
Represents a row or column on the game board. By convention, a vector has 4 tiles.
directions :: [Direction] Source #
Returns all of the directions.
>>>directions[West,South,East,North]
Calculates the rank of a tile.
>>>rank Nothing0>>>rank (Just 2)1>>>rank (Just 2048)11
emptyIndexes :: Vector -> [Int] Source #
Returns the indexes that don't contain tiles.
>>>emptyIndexes [Nothing, Just 2, Nothing, Nothing][0,2,3]