Index: hangman/hangman.retro =================================================================== --- hangman/hangman.retro +++ hangman/hangman.retro @@ -61,19 +61,19 @@ : guessChar ( c- ) guessed @ target @ rot toGuess ; ( --[ Printing ]---------------------------------------------- ) -: .target ( - ) target @ type ; -: .guessed ( - ) guessed @ type ; -: .input ( - ) ." Tries: ( " lifeline @ . ." ): " ; -: .fouls ( - ) ." Fouls: " foul-addr type ; +: .target ( - ) target @ print ; +: .guessed ( - ) guessed @ print ; +: .input ( - ) "Tries: ( " print lifeline @ . "): " print ; +: .fouls ( - ) "Fouls: " print foul-addr print ; : .prompt ( - ) 0 0 at-xy .guessed cr .fouls cr .input ; -: .already ( - ) ." [already guessed]" ; -: .correct ( - ) ." [correct guess] " ; +: .already ( - ) space "[already guessed]" print ; +: .correct ( - ) space "[correct guess] " print ; : .graphic ( - ) lives lifeline @ - 1- graphics + @ do ; -: .wrong ( - ) ." [not present] " .graphic ; +: .wrong ( - ) space "[not present] " print .graphic ; ( --[ Guessing ]---------------------------------------------- ) : 0<> ( x-f ) 0 = not ; : has ( $c-f ) findChar 0<> ; @@ -100,20 +100,20 @@ : revive ( - ) lives lifeline ! 0fouls ; : 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: " .target ; -: .win ( - ) foot .target cr ." You WIN!" ; +: .lose ( - ) foot "You LOSE; the word was: " print .target ; +: .win ( - ) foot .target cr "You WIN!" print ; : 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] " y-or-n ; +: .again? ( -f ) cr cr "Play again? [Y/N] " print y-or-n ; : play ( - ) initialise dict @ 0; drop repeat get-word hangman .again? 0 =if close-dict bye then again ; ( ============================================================ ) play