Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] allow 'look' from the command loop

  • Loading branch information...
commit 2efa9e7e9b6a61e994ea7cdbba8dfbc99f55b053 1 parent c848fd4
Carl Mäsak authored July 03, 2012

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

  1. 14  bin/crypt
14  bin/crypt
@@ -249,6 +249,8 @@ multi MAIN() {
249 249
     say "to find out...";
250 250
     say "";
251 251
 
  252
+    my $game = Crypt::Game.new();
  253
+
252 254
     loop {
253 255
         my $command = prompt('> ');
254 256
         given $command {
@@ -257,6 +259,18 @@ multi MAIN() {
257 259
                 last;
258 260
             }
259 261
 
  262
+            $command .= lc;
  263
+            $command .= trim;
  264
+
  265
+            when 'look' {
  266
+                my @events = $game.look();
  267
+                for @events {
  268
+                    when Crypt::PlayerLooked {
  269
+                        say "<{.description_of}>";
  270
+                    }
  271
+                }
  272
+            }
  273
+
260 274
             default {
261 275
                 say "Sorry, I did not understand that.";
262 276
             }

0 notes on commit 2efa9e7

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