Game-Life-Faster

 view release on metacpan or  search on metacpan

script/game-life-faster  view on Meta::CPAN


This command displays the grid. "Living" cells are represented by
C<'X'>, "dead" cells by C<'.'>.

=head2 help

This command displays the same help provided by the L<-help|/-help>
option, but the script does not exit.

=head2 living

This command displays the L<-living|/-living> setting. If an argument is
provided, the setting is changed to the first character of that value.

=head2 load

 life> load -living * grid.txt 2 2

This command loads the grid with the contents of the file specified as
the first argument. This file is a picture of the desired grid as "ASCII
art".

The second and third arguments specify the row and column coordinates of
the top left corner of the grid. Both default to C<0>.

This command also takes the option C<-living>, which specifies the
character which represents a living cell. The default is the value of
C<-living> which was specified when the script was launched. Any cell
represented by a character other than this is considered dead.

=head2 new

 life> new -faster 20 2 2,3

This command replaces the old game object with a new one. The arguments
are the same as for the script itself, but the only supported option is
L<-faster|/-faster>. All arguments and options default to their previous
value.

=head2 pause

This command displays the L<-pause|/-pause> setting. If an argument is
provided, the setting is changed to that value.

=head2 place_points

 life> place_points 0 0 .x ..x xxx

This command places points into the grid. The first two arguments are
the row and column coordinates of the first point. Subsequent arguments
are string representations of the points to be placed, with each
argument representing consecutive cells in consecutive rows. "Living"
cells are represented by C<'X'> or C<'x'>; any other character
represents a "dead" cell.

The example places a glider in the top-left corner of the grid.

=head2 process

This command causes the game to be processed. An optional parameter
specifies the number of iterations, the default being C<1>.

=head2 save

 life> save life.txt

This command saves the current object in a text file which contains the
F<game-life-faster> commands needed to recreate it. These commands can be
re-executed by:

 life> source life.txt

=head2 set_point

 life> set_point 1 2

This command causes the cell in the specified row and columns to be set
"living."

=head2 source

 life> source life.source

This command opens the given file and reads commands from it.

=head2 step

This is just a synonym for L<process|/process>.

=head2 unset_point

 life> unset_point 1 1

This command clears the point at the given row and column. It is
a synonym for L<clear_point|/clear_point>.

=head2 used

 life> used

This command displays the used portion of the grid as returned by
the
L<get_used_text_grid()|Game::Life::Faster/get_used_text_grid>
method.

=head1 AUTHOR

Thomas R. Wyant, III F<wyant at cpan dot org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2019-2022 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl 5.10.0. For more details, see the full text
of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.



( run in 0.941 second using v1.01-cache-2.11-cpan-71847e10f99 )