Back to main page Email me at: Gene!
Game play: When the program is executed, it will stop and display ENTER WORD. Player 1 should then enter a word or phrase. If a word without spaces is to be input, then it may be typed without the leading double quote mark (which usually indicates a string object). If a work or a phrase is desired, however, the leading double quote MUST be entered before the phrase is keyed in. Player 1 then pushes the CONT key.
The machine may then be given to player 2, who will see the following in the display: Level 4 of the stack will show the incorrect previously guessed letters (NONE is shown if there have not been any incorrect guesses), Level 3 of the stack will show the number of guess attempts remaining before being hung, Level 2 will show a string of dashes and spaces, with dashes in place of letters in the word or phrase, and Level 1 will show a prompt for player 2's guess.
Player 2 inputs a letter for a guess and presses CONT. If the letter is in the secret word, it will be replaced in its proper location. If the letter is not found, the number of incorrect guess attempts remaining before the player is hung will be reduced by 1, and the incorrect letter is added to the incorrect letter list shown in the display. This process continues until either the word/phrase has been guessed or 9 incorrect guesses have been made. A high or low tone is played depending on the outcome.
That is it. Enjoy!
Line Program instructions 01 << ->STR DUP SIZE 2 SWAP SUB DUP SIZE 1 - 02 1 SWAP SUB >> -> a << "ENTER WORD" HALT 03 SWAP DROP DUP TYPE IF 6 == THEN a EVAL END 04 DUP SIZE "" -> w s d << 1 s FOR j w j DUP 05 SUB IF " " == THEN d " " + ELSE d "-" + END 06 'd' STO NEXT 0 "" -> n b << DO "USED = " 07 IF n 0 <> THEN b ELSE "NONE" END + 9 n - 08 ->STR " GUESSES LEFT" + d "WHAT'S YOUR GUESS?" 09 HALT 5 ROLLD 4 DROPN DUP TYPE IF 6 == THEN 10 a EVAL END -> g << IF w g POS THEN 1 s 11 FOR j w j DUP SUB IF g == THEN IF j 1 == 12 THEN g ELSE d 1 j 1 - SUB g + END d j 1 + 13 MEM SUB + 'd' STO END NEXT ELSE n 1 + 'n' 14 STO b g + 'b' STO END >> UNTIL d "-" POS NOT 15 n 9 == OR END CLLCD IF n 9 >= THEN "YOU LOST" 16 1 DISP "WORD WAS..." 2 DISP w 3 DISP 100 1 17 BEEP ELSE "YOU GOT IT" 1 DISP w 2 DISP "ONLY " 18 n ->STR + " WRONG GUESSES" + 3 DISP 1800 1 19 BEEP END >> >> >>Note: The "" in lines 4 and 6 is a null string, while the " " in line 5 is a single space string.