Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[bin/crypt] can now also unlock by adding disk
Not only moving disks allows you to reach the achievement-unlocking "final"
disk configuration, but also adding disks.

Coke++ for discovering this loophole.
  • Loading branch information
Carl Masak committed Jul 2, 2012
1 parent ef96830 commit 9f9b0be
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/crypt
Expand Up @@ -179,6 +179,11 @@ class Hanoi::Game {
die X::Hanoi::DiskAlreadyOnARod.new(:$disk)
if grep { $disk eq any(@$_) }, %!state.values;
my @events = Hanoi::DiskAdded.new(:$disk, :$target);
if %!state<right> == @disks-1
&& $target eq 'right'
&& $!achievement eq 'locked' {
@events.push(Hanoi::AchievementUnlocked.new);
}
self!apply($_) for @events;
return @events;
}
Expand Down Expand Up @@ -461,6 +466,15 @@ multi MAIN('test', 'hanoi') {
Hanoi::AchievementLocked.new(),
), 'removing two disks from the right rod locks achievement';
}

{
$game.move('left', 'right');
$game.remove('tiny disk');
is $game.add(my $disk = 'tiny disk', my $target = 'right'), (
Hanoi::DiskAdded.new(:$disk, :$target),
Hanoi::AchievementUnlocked.new(),
), 'you can also unlock achievement by adding the disk';
}
}

{
Expand Down

0 comments on commit 9f9b0be

Please sign in to comment.