'Tetris, Elm, and Love for the Game'
###TL;DR: Was reading some Elm, found a tetris remake with a file that make me smile
A quick shout out to @jcollard for the code style in this file (link to source below):
module Tetromino where
import Location (..)import Util
-- A Tetromino is a list of Locations. By definition, a valid tetromino-- should contain exactly 4 different locationstype Tetromino = [Location]
-- A line piece-- ****line : Tetrominoline = [(0,0), (1,0), (2,0), (3,0)]
-- A square piece-- **-- **square : Tetrominosquare = [(0,0), (1,0), (0,1), (1,1)]-- A Z piece-- **-- **zpiece : Tetrominozpiece = [(0,0), (1,0), (1,1), (2,1)]-- An S piece-- **-- **spiece : Tetrominospiece = [ (1,0), (2,0), (0,1), (1,1)]
-- A J piece-- *-- *-- **jpiece : Tetrominojpiece = [ (1,0), (1,1), (0,2), (1,2)]
-- An L piece-- *-- *-- **lpiece : Tetrominolpiece = [(0,0), (0,1), (0,2), (1,2)]
-- A T piece-- ***-- *tpiece : Tetrominotpiece = [(0,0), (1,0), (2,0), (1,1)]The comments are one thing, but that’s some some serious love for the game when the code is shaped like the pieces.