Skip to content

Commit

Permalink
[bin/crypt] can walk down after solving hanoi
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Masak committed Jul 23, 2012
1 parent 69d6d84 commit 1df2f52
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bin/crypt
Expand Up @@ -2312,6 +2312,32 @@ multi MAIN('test') {
'moving disks in the right room (+)';
}

sub game_after_hanoi_is_solved {
my $game = game_from_hall();

multi hanoi_moves($source, $, $target, 1) { { :$source, :$target } }
multi hanoi_moves($source, $helper, $target, $n) {
hanoi_moves($source, $target, $helper, $n-1),
hanoi_moves($source, $helper, $target, 1),
hanoi_moves($helper, $source, $target, $n-1);
}

$game.use('flashlight');
$game.move(.<source>, .<target>)
for hanoi_moves('left', 'middle', 'right', 5);
return $game;
}

{
my $game = game_after_hanoi_is_solved();

is $game.walk('down')[0],
Adventure::PlayerWalked.new(
:to<cave>,
),
'can walk down after solving the hanoi game (+)';
}

done;
}

Expand Down

0 comments on commit 1df2f52

Please sign in to comment.