Browse files

Changed two lines to use ruby 1.9 behavior for string indexing (Strin…

…g#[] returns a string instead of a character code). Removed the "rescue exit" line as a clean exit is not a requirement. 267 bytes.
  • Loading branch information...
1 parent 56f2c9c commit d3182010c629a42a6e7bfee8c6f604aab334a891 @chron committed Mar 15, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 ruby/SimpleRLGolf.rb
@@ -3,6 +3,6 @@ def d t=?@;setpos $p/10,$p%10;addch t;end
s=init_screen;noecho;curs_set 0;s.keypad 1
b=0xf3e798070340902c0e019e7cf.to_s(2).tr'01',' #'
addstr b.scan(/.{10}/)*$/;$p=22;d
-while v=$p+'aMVX'[s.getch-258]-?W rescue exit
-d 32;$p=v if b[v]==32;d
+while v=$p+[10,-10,-1,1][s.getch-258]
+d 32;$p=v if b[v]==' ';d

0 comments on commit d318201

Please sign in to comment.