ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Games-Sokoban/Sokoban.pm
(Generate patch)

Comparing Games-Sokoban/Sokoban.pm (file contents):
Revision 1.1 by root, Tue May 11 23:17:47 2010 UTC vs.
Revision 1.5 by root, Tue May 11 23:48:40 2010 UTC

8 8
9=head1 DESCRIPTION 9=head1 DESCRIPTION
10 10
11I needed something like this quickly - if you need better docs, you have to ask. 11I needed something like this quickly - if you need better docs, you have to ask.
12 12
13Supports xsb (text), rle, sokevo and a small "binpack" format for input and 13Supports xsb (text), rle, sokevo and a small "binpack" format for input
14output. 14and output and can normalise levels as well as calculate unique IDs.
15 15
16=over 4 16=over 4
17 17
18=cut 18=cut
19 19
22use common::sense; 22use common::sense;
23 23
24use Carp (); 24use Carp ();
25use List::Util (); 25use List::Util ();
26 26
27our $VERSION = '0.01'; 27our $VERSION = '0.02';
28 28
29=item $level = new Games::Sokoban [format => "text|binpack"], [data => "###..."] 29=item $level = new Games::Sokoban [format => "text|rle|binpack"], [data => "###..."]
30 30
31=cut 31=cut
32 32
33sub new { 33sub new {
34 my ($class, %arg) = @_; 34 my ($class, %arg) = @_;
205 205
206sub as_lines { 206sub as_lines {
207 split /\n/, $_[0]{data} 207 split /\n/, $_[0]{data}
208} 208}
209 209
210=item @lines = $level->as_rle 210=item $line = $level->as_rle
211 211
212http://www.sokobano.de/wiki/index.php?title=Level_format 212http://www.sokobano.de/wiki/index.php?title=Level_format
213 213
214=cut 214=cut
215 215
222 222
223 $data 223 $data
224} 224}
225 225
226=item ($x, $y) = $level->start 226=item ($x, $y) = $level->start
227
228Returns (0-based) starting coordinate.
227 229
228=cut 230=cut
229 231
230sub start { 232sub start {
231 my ($self) = @_; 233 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines