UNPKG

nes-tetris-representation

Version:

A set of types and classes that represent the pieces, movement, and rng of NES Tetris

79 lines (78 loc) 1.39 kB
export declare enum Piece { I = 0, O = 1, T = 2, J = 3, L = 4, S = 5, Z = 6 } export declare const PieceList: { value: Piece; label: string; }[]; export declare enum Orientation { Down = 0, Right = 1, Up = 2, Left = 3 } export declare enum BlockValue { EMPTY = 0, ACTIVE_1 = 1, ACTIVE_2 = 2, ACTIVE_3 = 3, TRANSPARENT_1 = 4, TRANSPARENT_2 = 5, TRANSPARENT_3 = 6 } export declare type RowIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21; export declare type ColumnIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; export interface BlockPlace { row: RowIndex; column: ColumnIndex; value: BlockValue; } export interface ActivePiece { type: Piece; row: RowIndex; column: ColumnIndex; orientation: Orientation; blocks: BlockPlace[]; } export declare type Row = [ BlockValue, BlockValue, BlockValue, BlockValue, BlockValue, BlockValue, BlockValue, BlockValue, BlockValue, BlockValue ]; export declare type Grid = [ Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row, Row ];