Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] implement simple game loop

  • Loading branch information...
commit 247f52c0bc26534d372b4211050f146bc739cdef 1 parent b80e96e
Carl Mäsak authored July 03, 2012

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

  1. 26  bin/crypt
26  bin/crypt
@@ -228,6 +228,32 @@ class Hanoi::Game {
228 228
     }
229 229
 }
230 230
 
  231
+multi MAIN() {
  232
+    say "CRYPT";
  233
+    say "=====";
  234
+    say "";
  235
+
  236
+    say "You've heard there's supposed to be an ancient hidden crypt in these";
  237
+    say "woods. One containing a priceless treasure. Well, there's only one way";
  238
+    say "to find out...";
  239
+    say "";
  240
+
  241
+    loop {
  242
+        my $command = prompt('> ');
  243
+        given $command {
  244
+            when !.defined || .lc eq "q" | "quit" {
  245
+                say "";
  246
+                last;
  247
+            }
  248
+
  249
+            default {
  250
+                say "Sorry, I did not understand that.";
  251
+            }
  252
+        }
  253
+        say "";
  254
+    }
  255
+}
  256
+
231 257
 multi MAIN('hanoi') {
232 258
     my Hanoi::Game $game .= new;
233 259
     my @disks = <tiny small medium large huge> X~ ' disk';

0 notes on commit 247f52c

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