Copyright | (c) 2017 Samuel Tay <sam.chong.tay@gmail.com> |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Mario Lang <mlang@blind.guru> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A library implementation of Tetris.
This module has been taken from https://github.com/SamTay/tetris
Synopsis
- data Game
- data Direction
- boardWidth :: Int
- boardHeight :: Int
- initGame :: Int -> IO Game
- isGameOver :: Game -> Bool
- timeStep :: Game -> IO Game
- rotate :: Game -> Game
- shift :: Direction -> Game -> Game
- hardDrop :: Game -> Game
- class Translatable s where
- translate :: Direction -> s -> s
- translateBy :: Int -> Direction -> s -> s
- board :: Lens' Game Board
- shape :: Lens' Block Tetrimino
- origin :: Lens' Block Coord
- score :: Lens' Game Int
- block :: Lens' Game Block
- coords :: Block -> [Coord]
- nextShape :: Lens' Game Tetrimino
- initBlock :: Tetrimino -> Block
Documentation
Game state
boardWidth :: Int Source #
Visible, active board size
boardHeight :: Int Source #
Visible, active board size
isGameOver :: Game -> Bool Source #
rotate :: Game -> Game Source #
Handle counterclockwise block rotation (if possible) Allows wallkicks: http://tetris.wikia.com/wiki/TGM_rotation
shift :: Direction -> Game -> Game Source #
Try to shift current block; if shifting not possible, leave block where it is
class Translatable s where Source #