! Copyright (C) 2006, 2007, 2008 Alex Chapman
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel arrays namespaces sequences math math.order
-math.vectors colors colors.constants random ;
+
+USING: colors math namespaces random sequences ;
+
IN: tetris.tetromino
-TUPLE: tetromino states colour ;
+TUPLE: tetromino states color ;
C: <tetromino> tetromino
[
{ {
{ 0 0 } { 1 0 } { 2 0 } { 3 0 }
- }
+ }
{ { 0 0 }
{ 0 1 }
{ 0 2 }
}
} COLOR: orange
] [
- {
+ {
{ { 0 0 } { 1 0 } { 2 0 }
{ 2 1 }
} {
tetrominoes get random ;
: blocks-max ( blocks quot -- max )
- map [ 1+ ] [ max ] map-reduce ; inline
+ map supremum 1 + ; inline
: blocks-width ( blocks -- width )
[ first ] blocks-max ;
: blocks-height ( blocks -- height )
[ second ] blocks-max ;
-