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.11 by root, Wed May 12 20:49:08 2010 UTC vs.
Revision 1.12 by root, Wed May 12 20:55:30 2010 UTC

152 } 152 }
153} 153}
154 154
155=item $text = $level->as_text 155=item $text = $level->as_text
156 156
157Returns the level in xsb/text format - every row of the level is one line
158ended by a newline, e.g.:
159
160 "###\n# #\n###\n"
161
157=cut 162=cut
158 163
159sub as_text { 164sub as_text {
160 my ($self) = @_; 165 my ($self) = @_;
161 166
208 pack "wwB*", $w - 2, $s, $data 213 pack "wwB*", $w - 2, $s, $data
209} 214}
210 215
211=item @lines = $level->as_lines 216=item @lines = $level->as_lines
212 217
218Returns the level as a list of rows, each row is a text representation of
219the respective level row, e.g.:
220
221 ("###", "# #", "###")
222
213=cut 223=cut
214 224
215sub as_lines { 225sub as_lines {
216 split /\n/, $_[0]{data} 226 split /\n/, $_[0]{data}
217} 227}
218 228
219=item $line = $level->as_rle 229=item $line = $level->as_rle
220 230
221http://www.sokobano.de/wiki/index.php?title=Level_format 231http://www.sokobano.de/wiki/index.php?title=Level_format
232
233Example:
234
235 "3#|# #|3#"
222 236
223=cut 237=cut
224 238
225sub as_rle { 239sub as_rle {
226 my $data = $_[0]{data}; 240 my $data = $_[0]{data};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines