-
-
28 Nov 2016 21:30:45 UTC
- Distribution: Karel
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (492 / 0 / 10)
- Kwalitee
Bus factor: 1- 96.60% Coverage
- License: artistic_2
- Perl: v5.10.0
- Activity
24 month- Tools
- Download (21.43KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Clone
- Cwd
- Exporter
- List::Util
- Marpa::R2
- Module::Load
- Moo
- Syntax::Construct
- constant
- namespace::clean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Karel::Grid
DESCRIPTION
Represents the map in which the robot moves.
METHODS
- 'Karel::Grid'->new
-
my $grid = 'Karel::Grid'->new( x => 10, y => 12 );
The constructor creates an empty grid of the given size.
- $grid->x, $grid->y
-
my ($x, $y) = map $grid->$_, qw( x y );
Returns the size of the grid.
- $grid->at($x, $y)
-
Returns a space if there's nothing at the given position. For marks, it returns 1 - 9. For walls, it returns "W" (outer walls) or "w" (inner walls).
- $grid->build_wall($x, $y)
-
Builds a wall ("w") at the given coordinates.
- $gird->remove_wall($x, $y)
-
Removes a wall ("w") from the given coordinates. Dies if there's no wall.
- $grid->drop_mark($x, $y)
-
Drop a mark at the given position. There must be an empty place or less than 9 marks, otherwise the method dies.
- $grid->pick_mark($x, $y)
-
Pick up a mark from the given position. Dies if there's no mark.
- $grid->clear($x, $y)
-
Set the given position to empty (" ").
Module Install Instructions
To install Karel, copy and paste the appropriate command in to your terminal.
cpanm Karel
perl -MCPAN -e shell install Karel
For more information on module installation, please visit the detailed CPAN module installation guide.