This is my version of the "Hangman" game, where one player has to enter a word which must be guessed by the other player. Due to the limited display of the HP-41CX it's not possible to build up the gallows. Instead of this I implemented something other . . . ;-) --- Perhaps I should mention at this point, that I've done community service ! ;-)
Course of Game :
On starting the program the first player has to enter a word consisting of maximal nine characters. After pressing R/S now as many underlines "_" are displayed as the word is composed of characters.
Now the second player enters a letter and presses R/S. If these letter is contained in the hidden word, it now appears at the corresponding positions in the display instead of the underlines "_". If the letter was wrong, one after another the "pieces" of the men appear on the right side of the display. After the tenth unsuccsessful try the "execution" takes place. Afterwards the hidden word is shown. If the second player did guess the word in addition the number of miss tries is displayed.
Program Listing :
001 LBL "GAME1" 002 "HANGMAN" 003 AVIEW 004 CF 05 005 CF 06 006 CLA 007 ,02 008 CLRGX 009 " " (space) 010 ASTO 17 011 "_" (5F) 012 ASTO 07 013 ASTO 08 014 ASTO 09 015 ASTO 10 016 ASTO 11 017 ASTO 12 018 ASTO 13 019 ASTO 14 020 ASTO 15 021 AON 022 CF23 023 LBL 03 024 TONE 5 025 " WORD ?" 026 PROMPT 027 FC?C 23 028 GTO 03 029 9 030 ALENG 031 STO 02 032 X>Y? 033 GTO 02 034 6 035 X<Y? 036 GTO 00 037 ASTO 00 038 GTO 01 039 LBL 02 040 "WORD 2 LONG" 041 AVIEW 042 PSE 043 GTO 03 044 LBL 00 045 ASTO 00 046 ASHF 047 ASTO 01 048 SF05 049 LBL 01 050 CLA 051 7 052 STO 03 053 LBL 06 054 ARCL IND 03 055 ISG 03 056 "" (NOP) 057 RCL 02 058 7 059 + 060 RCL 03 061 X<Y? 062 GTO 06 063 FC?C 06 064 GTO 08 065 TONE 1 066 GTO 09 067 LBL 08 068 TONE 9 069 LBL 09 070 ARCL 17 071 AVIEW 072 STOP 073 ASTO 04 074 RCL d 075 AVIEW 076 STO d 077 CLA 078 ARCL 00 079 FS? 05 080 ARCL 01 081 , 082 STO 05 083 STO 06 084 LBL 04 085 RCL 04 086 POSA 087 X<0? 088 GTO 05 089 STO 05 090 E 091 + 092 ST+ 06 093 RCL 02 094 RCL 06 095 X>Y? 096 GTO 01 097 RCL 06 098 6 099 + 100 RCL 04 101 STO IND Y 102 ISG 20 103 "" (NOP) 104 RCL 02 105 RCL 20 106 X=Y? 107 GTO 14 108 RCL 05 109 E 110 + 111 AROT 112 GTO 04 113 LBL 05 114 SF 06 115 " " (60 06 04 01) 116 3 117 RCL 16 118 X>Y? 119 GTO 10 120 XEQ 11 121 GTO 12 122 LBL 10 123 6 124 RCL 16 125 X>Y? 126 GTO 16 127 3 128 XEQ 11 129 CLA 130 ARCL 17 131 " " (7F 20) 132 ASTO 17 133 " " (60 04 01) 134 RCL 16 135 4 136 - 137 AROT 138 ATOX 139 CLA 140 ARCL 17 141 XTOA 142 ASTO 17 143 GTO 12 144 LBL 16 145 3 146 XEQ 11 147 " " (3C 1D) 148 RCL 16 149 7 150 - 151 AROT 152 ATOX 153 CLA 154 ARCL 17 155 XTOA 156 " " (7F 01) 157 ASTO 17 158 LBL 12 159 ISG 16 160 "" 161 E1 162 RCL 16 163 X=Y? 164 GTO 13 165 GTO 01 166 LBL 11 167 AROT 168 ATOX 169 CLA 170 XTOA 171 ASTO 17 172 RTN 173 LBL 13 174 " LOSER" 175 AVIEW 176 TONE 9 177 TONE 7 178 TONE 6 179 TONE 3 180 PSE 181 " EXECUTION" 182 AVIEW 183 PSE 184 " " (20 20 20 20 20 20 20 20 20 01 1D 01) 185 XEQ 00 186 " " (20 20 20 20 20 20 20 20 01 20 1D 01) 187 XEQ 00 188 " " (20 20 20 20 20 20 20 01 20 20 1D 01) 189 XEQ 00 190 " " (20 20 20 20 20 20 01 20 20 20 1D 01) 191 XEQ 00 192 " " (20 20 20 20 20 01 20 20 20 20 1D 01) 193 XEQ 00 194 " " (20 20 20 20 01 20 20 20 20 2D 3C 01) 195 XEQ 00 196 " " (20 20 20 20 01 20 20 20 2D 20 3C 01) 197 XEQ 00 198 " " (20 20 20 01 20 20 20 2D 20 20 3C 01) 199 XEQ 00 200 " " (20 20 20 01 20 20 2D 20 20 20 3C 01) 201 XEQ 00 202 " " (20 20 01 20 20 2D 20 20 20 20 3C 01) 203 XEQ 00 204 " " (20 20 01 20 2D 20 20 20 20 20 3C 01) 205 XEQ 00 206 " " (20 20 01 2D 20 20 20 20 20 20 3C 01) 207 XEQ 00 208 "AAARRRGGH..." 209 AVIEW 210 TONE 10 211 " " (20 7F 0D 20 20 20 20 20 20 20 3C 01) 212 AVIEW 213 PSE 214 PSE 215 " WANTED " 216 "WORD:" 217 AVIEW 218 PSE 219 CLA 220 " " (space) 221 ARCL 00 222 FS? 05 223 ARCL 01 224 AVIEW 225 GTO 07 226 LBL 00 227 AVIEW 228 9 (PSE lasts too long, therefore) 229 LN (here calculation of logarithm) 230 RTN 231 LBL 14 232 CLA 233 ARCL 00 234 FS? 05 235 ARCL 01 236 BEEP 237 AVIEW 238 PSE 239 PSE 240 "CONGRATULATE" 241 AVIEW 242 TONE 3 243 TONE 4 244 TONE 5 245 TONE 8 246 TONE 7 247 TONE 8 248 TONE 9 249 CLA 250 FIX 0 251 CF 29 252 ARCL 16 253 " WRONG" 254 AVIEW 255 LBL 07 256 AOFF 257 CLA 258 ,02 259 CLRGX 260 CLST 261 X<>F 262 CLX 263 FIX 4 264 SF 29 265 END
Back to HP-41CX Selected (game) programs
Back to Natural Sciences and Mathematical Games
Kai Schröder, 30.5.2001