Not logged in

Differences From Artifact [4d27dce6ecc86ed4]:

File hangman/hangman.retro part of check-in [24efd34450] - fix hangman game to work with latest image by crc on 2010-09-15 18:23:26. [annotate] [view]

To Artifact [2035bdd786cfc443]:

File hangman/hangman.retro part of check-in [720b103870] - Update hangman game for latest image by charleschilders on 2010-09-19 23:15:42. [annotate] [view]


@@ -52,27 +52,27 @@
 
 ( The array contains offset information; set the guess string )
 
 : update-guessed ( $ offsets len - )
-  for 2dup @ + this-char @ swap ! 1+ next 2drop ;
+  for 2dup @ + @this-char swap ! 1+ next 2drop ;
 
 : toGuess ( guessed target c - )
   dup this-char !  offsets            ( guessed offsets length )
   2dup 2push  update-guessed  2pop unarray ;
 
-: guessChar ( c- )  guessed @ target @ rot toGuess ;
+: guessChar ( c- )  @guessed @target rot toGuess ;
 
 ( --[ Printing ]---------------------------------------------- )
 
-: .target   ( - )  target @ print ;
-: .guessed  ( - )  guessed @ print ;
-: .input    ( - )  "Tries: ( " print lifeline @ . "): " print ;
-: .fouls    ( - )  "Fouls: " print foul-addr print ;
+: .target   ( - )  @target  puts ;
+: .guessed  ( - )  @guessed puts ;
+: .input    ( - )  "Tries: (" puts lifeline @ putn "): " puts ;
+: .fouls    ( - )  "Fouls: " puts foul-addr puts ;
 : .prompt   ( - )  0 0 at-xy .guessed cr .fouls cr .input ;
-: .already  ( - )  space "[already guessed]" print ;
-: .correct  ( - )  space "[correct guess]  " print ;
+: .already  ( - )  space "[already guessed]" puts ;
+: .correct  ( - )  space "[correct guess]  " puts ;
 : .graphic  ( - )  lives lifeline @ - 1- graphics + @ do ;
-: .wrong    ( - )  space "[not present]    " print .graphic ;
+: .wrong    ( - )  space "[not present]    " puts .graphic ;
 
 ( --[ Guessing ]---------------------------------------------- )
 
 : 0<>   (  x-f ) 0 = not ;
@@ -101,19 +101,19 @@
 : remaining ( -f )  guessed @ '_ has ;
 : alive     ( -f )  remaining lifeline @ 0<> and ;
 : dead      ( -f )  alive not ;
 : foot      (  - )  0 20 at-xy ;
-: .lose     (  - )  foot "You LOSE; the word was: " print .target ;
-: .win      (  - )  foot .target cr "You WIN!" print ;
+: .lose     (  - )  foot "You LOSE; the word was: " puts .target ;
+: .win      (  - )  foot .target cr "You WIN!" puts ;
 : endgame   (  - )  lifeline @ if .win else .lose then ;
 : (hangman) (  - )  clear repeat dead if endgame ;then guess again ;
 : hangman   ( $- )  >target revive (hangman) ;
 
 ( --[ Main Game ]--------------------------------------------- )
 
 : y-or-n    ( -f )  key dup 'y = swap 'Y = or ;
-: .again?   ( -f )  cr cr "Play again? [Y/N] " print y-or-n ;
+: .again?   ( -f )  cr cr "Play again? [Y/N] " puts y-or-n ;
 : play      ( -  )
   initialise dict @ 0; drop
   repeat get-word hangman .again? 0 =if close-dict bye then again ;
 ( ============================================================ )
 play