Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] can walk down after solving hanoi

  • Loading branch information...
commit 1df2f524eead44c646574ebaf356add7d98fb9c3 1 parent 69d6d84
Carl Mäsak authored July 23, 2012

Showing 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. 26  bin/crypt
26  bin/crypt
@@ -2312,6 +2312,32 @@ multi MAIN('test') {
2312 2312
             'moving disks in the right room (+)';
2313 2313
     }
2314 2314
 
  2315
+    sub game_after_hanoi_is_solved {
  2316
+        my $game = game_from_hall();
  2317
+
  2318
+        multi hanoi_moves($source, $, $target, 1) { { :$source, :$target } }
  2319
+        multi hanoi_moves($source, $helper, $target, $n) {
  2320
+            hanoi_moves($source, $target, $helper, $n-1),
  2321
+            hanoi_moves($source, $helper, $target, 1),
  2322
+            hanoi_moves($helper, $source, $target, $n-1);
  2323
+        }
  2324
+
  2325
+        $game.use('flashlight');
  2326
+        $game.move(.<source>, .<target>)
  2327
+            for hanoi_moves('left', 'middle', 'right', 5);
  2328
+        return $game;
  2329
+    }
  2330
+
  2331
+    {
  2332
+        my $game = game_after_hanoi_is_solved();
  2333
+
  2334
+        is $game.walk('down')[0],
  2335
+            Adventure::PlayerWalked.new(
  2336
+                :to<cave>,
  2337
+            ),
  2338
+            'can walk down after solving the hanoi game (+)';
  2339
+    }
  2340
+
2315 2341
     done;
2316 2342
 }
2317 2343
 

0 notes on commit 1df2f52

Please sign in to comment.
Something went wrong with that request. Please try again.