--- Games-Sokoban/Sokoban.pm 2010/05/12 10:47:12 1.9 +++ Games-Sokoban/Sokoban.pm 2010/05/12 17:52:11 1.10 @@ -24,7 +24,7 @@ use Carp (); use List::Util (); -our $VERSION = '0.02'; +our $VERSION = '1.0'; =item $level = new Games::Sokoban [format => "text|rle|binpack"], [data => "###..."] @@ -247,14 +247,24 @@ =item $level->hflip +Mirror horizontally. + =item $level->vflip -=item $level->transpose # topleft to bottomright +Mirror vertically. + +=item $level->transpose + +Transpose level (mirror at top-left/bottom-right diagonal). =item $level->rotate_90 +Rotate by 90 degrees clockwise. + =item $level->rotate_180 +Rotate by 180 degrees clockwise. + =cut sub hflip { @@ -351,8 +361,8 @@ =item $id = $level->normalise -normalises the level map and calculates/returns it's identity code - +Simplifies the level map and calculates/returns its identity code. +. http://www.sourcecode.se/sokoban/level_id.php, assume uppercase and hex. =cut @@ -407,7 +417,7 @@ while (<$fh>) { chomp; - my %meta = split /[:\n]/; + my %meta = split /(?:: |\n)/; $_ = <$fh>; @@ -416,6 +426,9 @@ # sokevo internally locks some cells y/^%:,;-=?/ #.$* +#/; + # skip levels without pusher + y/@+// or next; + push @levels, new Games::Sokoban data => $_, meta => \%meta; }