Permalink
Browse files

[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...
1 parent ef96830 commit 9f9b0becffa6fbca5c511fa6e78e7226a09b4331 @masak committed Jul 2, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 bin/crypt
View
@@ -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;
}
@@ -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';
+ }
}
{

0 comments on commit 9f9b0be

Please sign in to comment.