Games::Tetris - representation of a tetris game state
use Games::Tetris; my $well = Games::Tetris->new; my $ess = $well->new_shape(' +', '++', '+ '); $well->drop( $ess, 3, 1 ); $well->print;
This module can be used as the rules engine for the game of tetris. It allows you to create a well and drop pieces in it. The well tracks the status its contents and handles completed line removal.
Creates a new gamestate
Takes the following optional parameters:
well an initial well, an array of arrays. use undef to indicate an empty cell, any other value is considered occupied
well
or
width, depth dimensions of a new well (defaults to 15 x 20)
width
depth
delegates to Games::Tetris::Shape->new
used by the testsuite. prrints the current state of the well
returns a true value if the given shape would fit in the well at the location $x, $y
$x, $y
returns false if the shape will not fit at the location indicated by $x, $y
if the shape can be dropped it will be advanced to the bottom of the well and the return value will be the rows removed by the dropping operation, if any, as an array reference
Richard Clamp <richardc@unixbeard.net>
Copyright (C) 2003 Richard Clamp. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Games::Tetris::Shape
To install Games::Tetris, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Tetris
CPAN shell
perl -MCPAN -e shell install Games::Tetris
For more information on module installation, please visit the detailed CPAN module installation guide.