This program is Copyright © HP and is used here by permission. It was originally printed in the Games Solution Book. This program was entered and uploaded by Tony Duell. The documentation was entered by Dave Hicks. The Barcode for this program was provided by Brian Ward.
This program is supplied without representation or warranty of any kind. Tony Duell, Hewlett Packard and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
This program pits the HP-41C against a human opponent in a game of 3-D Tic Tac Toe. The rules of this game are simple:
1) The board consists of 4 levels, each of which is 4 rows deep and 4 columns
across, making a total of 64 squares on a 3 dimensional board.
2) Two players move alternately by placing a black or white marker on a square
(or making an X or a O on a paper layout of the board). Once a move is made,
the piece is never moved or removed. In this game, the human always goes
first.
3) A player wins by placing four markers in a straight line. The line can
lie in more than one level, and diagonals are perfectly legitimate wins.
In short, the game is played just like regular Tic Tac Toe, except that the board has one additional dimension, and is one square bigger in all dimensions. Unlike regular Tic Tac Toe, there is no known winning strategy for the 3-D version. It is a much more complex game which can require considerable skill in a player, allowing for very complicated strategies.
The 41C plays and remembers the game by dividing the board into its 16 component rows and storing an entire row in one register. The registers R0 through R15 are reserved for the game board.
Each square on the board can be characterized by its level=z, its row=y and its column=x. x,y, and z can have values from 1 through 4. When entering moves, make sure they are 3 digit numbers. All three digits must be between 1 and 4 inclusive. Entering a move outside this range may cause the program to make erroneous entries in the board.
The boards look like:
Note:Requires 2 Memory Modules for use on the HP-41C.
Step |
Instructions |
Input Data/Units |
Keys |
Output Data/Units |
1 |
Enter program |
|||
2 |
Initialize |
|
[XEQ] 3DTTT |
READY |
3 |
Key in your move | xyz |
[R/S] |
MY MOVE: |
|
Repeat 3 until you win or lose |
|
|
|
Keystrokes: Display: [XEQ] [ALPHA] SIZE [ALPHA] 026 [XEQ] [ALPHA] 3DTTT [ALPHA] READY 242 [R/S] MY MOVE: 322 414 [R/S] MY MOVE: 134 123 [R/S] MY MOVE: 234 441 [R/S] MY MOVE: 423 141 [R/S] MY MOVE: 232 214 [R/S] MY MOVE: 114 424 [R/S] MY MOVE: 434 111 [R/S] 334, I WIN
The boards look like:
How to get this Program to your Calculator (via
HP-IL, disk, wand, and fingers)
Download Binary (.raw) program for disk or PC HP-IL
Card download
Download Hexadecimal (.dat) program for Serial Port
download
Display the Program Barcode (.pdf) for printing and scanning
LINE KEYS 01 LBL "3DTTT" 02 FIX 00 03 CLRG 04 CF 00 05 CF 01 06 CF 02 07 CF 03 08 CF 29 09 "READY" 10 AVIEW 11 LBL A 12 STOP 13 1 E3 14 / 15 STO 19 16 0 17 STO 16 18 2 19 STO 17 20 RDN 21 RDN 22 XEQ 10 23 STO 25 24 RCL 20 25 RCL IND 25 26 * 27 INT 28 1 E2 29 / 30 FRC 31 "ILLEGAL MOVE" 32 X#0? 33 AVIEW 34 X#0? 35 GTO A 36 5 37 RCL 20 38 / 39 1 40 + 41 ST+ IND 25 42 RCL 18 43 X=0? 44 GTO 01 45 SF 00 46 XEQ 04 47 CF 02 48 CF 03 49 CF 00 50 .06 51 RCL 18 52 FRC 53 STO 18 54 X>Y? 55 GTO 02 56 X=Y? 57 GTO 03 58 LBL 01 59 1 E-2 60 ST+ 18 61 SF 02 62 GTO 03 63 LBL 02 64 XEQ 10 65 XEQ 04 66 FS?C 02 67 GTO 03 68 RCL 19 69 XEQ 10 70 LBL 03 71 RCL 16 72 INT 73 1 74 - 75 3 76 / 77 21 78 + 79 ENTER 80 FRC 81 X=0? 82 CF 01 83 .5 84 X>Y? 85 SF 00 86 GTO IND Z 87 LBL 10 88 10 89 * 90 INT 91 LASTX 92 FRC 93 10 94 * 95 INT 96 LASTX 97 FRC 98 .5 99 - 100 CHS 101 20 102 * 103 10^X 104 STO 20 105 RDN 106 1 107 - 108 STO 21 109 X<>Y 110 1 111 - 112 4 113 * 114 STO 22 115 + 116 STO 23 117 RTN 118 LBL 04 119 1 120 RCL 22 121 XEQ 01 122 4 123 RCL 21 124 XEQ 01 125 5 126 ENTER 127 0 128 XEQ 01 129 3 130 ENTER 131 XEQ 01 132 0 133 STO 24 134 RCL 23 135 STO 25 136 GTO 02 137 LBL 01 138 CF 01 139 STO 25 140 RDN 141 STO 24 142 XEQ 02 143 SF 01 144 RCL 24 145 CHS 146 STO 24 147 XEQ 02 148 RCL 24 149 CHS 150 STO 24 151 LBL 02 152 1 153 ST+ 18 154 1 E2 155 ENTER 156 ENTER 157 RCL IND 25 158 X<> 25 159 RCL 24 160 + 161 X<> 25 162 FS? 01 163 * 164 RCL IND 25 165 + 166 X<> 25 167 RCL 24 168 + 169 X<> 25 170 FS? 01 171 * 172 RCL IND 25 173 + 174 X<> 25 175 RCL 24 176 + 177 X<> 25 178 FS? 01 179 * 180 RCL IND 25 181 + 182 FS? 01 183 GTO 01 184 R^ 185 RCL 20 186 / 187 / 188 LBL 01 189 FRC 190 R^ 191 * 192 INT 193 4 194 X<>Y 195 FS? 00 196 GTO 01 197 X>Y? 198 RTN 199 GTO 02 200 LBL 01 201 5 202 / 203 "YOU WIN" 204 X=Y? 205 PROMPT 206 FRC 207 X#0? 208 RTN 209 LASTX 210 LBL 02 211 RCL 17 212 X>Y? 213 RTN 214 X<>Y 215 SF 02 216 STO 17 217 FC? 00 218 SF 03 219 RCL 18 220 STO 16 221 RTN 222 LBL 21 223 1 224 RCL 22 225 GTO 01 226 LBL 22 227 4 228 RCL 21 229 GTO 01 230 LBL 23 231 5 232 ENTER 233 0 234 GTO 01 235 LBL 24 236 3 237 ENTER 238 GTO 01 239 LBL 25 240 SF 01 241 0 242 RCL 23 243 LBL 01 244 STO 25 245 RDN 246 STO 24 247 1 E2 248 ENTER 249 1 E8 250 FS? 00 251 X<>Y 252 FS? 01 253 STO 20 254 RCL 20 255 LBL 05 256 XEQ 19 257 X<> 25 258 RCL 24 259 + 260 X<> 25 261 1 E-2 262 FS? 00 263 1/X 264 RCL 20 265 FS? 01 266 * 267 GTO 05 268 LBL 20 269 16 270 STO 20 271 4 272 STO 25 273 1 274 STO 24 275 XEQ 07 276 2 277 XEQ 07 278 3 279 XEQ 07 280 0 281 XEQ 08 282 RCL 22 283 4 284 STO 24 285 * 286 STO 23 287 16 288 STO 20 289 1 290 XEQ 08 291 2 292 XEQ 08 293 3 294 XEQ 08 295 0 296 XEQ 08 297 RCL 22 298 RCL 23 299 + 300 STO 25 301 LBL 09 302 RCL IND 25 303 RCL 24 304 X<=Y? 305 GTO 01 306 RCL 25 307 2 308 / 309 FRC 310 X=0? 311 GTO 02 312 GTO 03 313 LBL 01 314 RCL 25 315 + 316 16 317 X>Y? 318 CLX 319 - 320 STO 25 321 GTO 09 322 LBL 08 323 STO 25 324 LBL 07 325 RCL IND 25 326 X<> 25 327 RCL 24 328 + 329 X<> 25 330 RCL IND 25 331 + 332 X<> 25 333 RCL 24 334 + 335 X<> 25 336 RCL IND 25 337 + 338 X<> 25 339 RCL 24 340 + 341 X<> 25 342 RCL IND 25 343 + 344 X<> 25 345 RCL 24 346 + 347 X<> 25 348 INT 349 RCL 20 350 X<=Y? 351 RTN 352 RDN 353 STO 20 354 RDN 355 STO 22 356 RTN 357 LBL 02 358 1 E2 359 XEQ 19 360 1 E4 361 XEQ 19 362 1 E8 363 XEQ 19 364 LBL 03 365 1 E6 366 XEQ 19 367 1 E4 368 XEQ 19 369 1 E2 370 XEQ 19 371 1 E8 372 LBL 19 373 STO 20 374 RCL IND 25 375 * 376 INT 377 1 E2 378 / 379 FRC 380 X#0? 381 RTN 382 RCL 20 383 1/X 384 ST+ IND 25 385 LOG 386 2 387 / 388 5 389 + 390 RCL 25 391 4 392 / 393 INT 394 LASTX 395 FRC 396 4 397 * 398 1 399 ST+ IND 25 400 + 401 X<>Y 402 1 403 + 404 10 405 * 406 + 407 10 408 * 409 + 410 CLA 411 ARCL X 412 1 E3 413 / 414 FS?C 02 415 GTO 01 416 STO 18 417 RCL 17 418 3 419 X>Y? 420 GTO 01 421 FC? 03 422 GTO 01 423 ", I WIN" 424 AVIEW 425 GTO A 426 LBL 01 427 ASTO X 428 "MY MOVE: " 429 ARCL X 430 AVIEW 431 GTO A 432 END
Go back to the HP-41 software library
Go back to the general software library
Go
back to the main exhibit hall