Games::Mines::Play;
require Games::Mines::Play; # get new 30x40 mine field with 50 mines my($game) = Games::Mines->new(30,40,50); # use color text $game->set_ANSI_Color; # fill with mines, except at the four corners $game->fill_mines([0,0],[0,40],[30,0],[30,40]); # print out playing field $game->print_out("field"); $game->print_status_line;
This module is he basis for mine finding game. It builds on the Games::Mines base class to with all the various methods needed to play a text version of the game.
The new method creates a new mine field object. It takes three arguments: The width of the field, the height of the field, and the number of mines.
Returns an array of width, height, and number of mines, based on some common arguments. It takes a has with the some combination of six keys. The first three are small, medium, and large. These are boolean keys, who's value are only checked to see if they contain a true value. The small field is 8x8 with 10 mines, the medium field is 16x16 with 40 mines, and the large field is 16x30 with 99 mines. The other three are width, height, and mines, which sets the corresponding term. Note that this is designed to work with Getopt::Long, so any other keys are ignored. The default is to return a large field.
Prints out the game field. It takes one argument, saying what to print. The "field" argument prints out the current visible field. The "solution" argument prints out the actual location of the mines. The "check" argument prints out the field, marking any mistakes that where made. Default is is to print a "field".
Prints out a status line of how many mines have been located. If the game has ended, it also prints out the ending text saying why.
Set the default mapping of the internal representation to the actual characters printed out, to a plain ascii characters.
Set the default mapping of the internal representation to the actual characters printed out, to ascii characters with ANSI colors. If Term::ANSIColor is not installed on your machine, this will quietly fail.
Saves the current game. Takes two arguments: The filename to save it to, and the game number to save it under. Note that if you give it a game number that already exists within that file, that game will get over written by this one. If no such game number exists, then it is simply added to the end.
Loads a previously saved game to replace the current game. It takes two arguments: the file name to get the game from and the game number to load. If it can't open the file or find the given game number will leave the current game unchanged, and return undefined.
2 POD Errors
The following errors were encountered while parsing the POD:
=over without closing =back
'=end for developers' is invalid. (Stack: =over; =begin for)
To install Games::Mines, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Mines
CPAN shell
perl -MCPAN -e shell install Games::Mines
For more information on module installation, please visit the detailed CPAN module installation guide.