return to Geek-fun,-Software
3-Dimensional Tic Tac Toe game
from Warren Ring
in BASIC
wring (at) wowway (dot) com
September 20, 2009Sept 20, 2009 -Van Snyder's MAT expansion and apparently running code below.
Ed,
I have a demo program for you that I believe will knock the socks off anyone who thinks old computers couldn’t do serious computation. It’s a 3-dimensional Tic Tac Toe game. Parker Brothers sold it under the name “Qubic” many years ago. You can buy a game board for about $12 on eBay. See the attached photos. (Long ago, I put Dymo labeling tape on each square.)
If you’re interested, I can send you the source code (in BASIC). One of your programmers could convert it to Autocoder, and guests could play against the 1401. They could enter their moves via the 1401’s sense switches, and the 1401 could respond by printing its move on the printer. The program is very fast, and almost unbeatable. Virtually everyone who plays will come away saying “I got beat at 3D tic tac toe by a 40-year-old computer.”
Where I got the program:
Back around 1969, my brother, David Ring, was a computer lab assistant at the University of Illinois in Urbana. They had a room-sized computer called the Illiac II. The university had an engineering open house, and my brother invited me to town, and that night took me to a room full of teletypes, logged me on, and showed me how I could play 3-dimensional tic tac toe.
I played a few games, and got beat every time. When he walked away, being the nerd that I was, I turned on the paper tape punch, typed “LIST”, and out came the source code in BASIC, which I took home. Years later, I converted it to Turbo C under Windows 98, and studied how it worked. It appears to have been originally written in assembler on a computer called the “TX0”.
So if you would like, I can send you the source code for the program, along with notes I’ve made for converting it from BASIC to Autocoder. I scanned the three pages of BASIC source code listing into PDF files. Let me know what you guys think. And thanks again for your on-line journal. I’ve read the entire history. (I used to program SPS-2 on a 1401.)
Warren Ring
wring@wowway.com===================================================
Ed,
Attached are the files containing the source code for 3D tic-tac-toe, 4 in a row (which the 1401 could play as a demo game) in BASIC. It’s only 3 pages of source code.
Each about 300 K bytes
ttt3d-1-.jpg lines 100 through 490 ttt3d-2-.jpg lines 500 through 1090 ttt3d-3-.jpg lines 1100 through 1370, and start of user interaction and 2 pages of TTY user interaction
ttt3d-4-.jpg user interaction ttt3d-5-.jpg user interaction Ed Thelen has made an unverified text file of the code and data here
While it’s unsuitable to scan with OCR, if you zoom in, you can clearly see the original characters, and observe a number of things:
- This is teletype output (I have the original), and I wrote on it with a pen when I was analyzing the program.
- The bottom of the listing (on page 5) shows that this game was played on a DEC system running RSTS (on an 11/70, as I recall) at Taylor University (my alma mater) on April 20th, 1974. This is because I had saved the paper tape from U of I, and loaded it onto the DEC system (I graduated from Taylor in 1973 with a bachelor’s, in addition to graduation from DeVry with an associate’s in Chicago in 1969) on a visit.
- I beat the computer. In the 5 intervening years, I had analyzed the program and found that it could be beat, but only if you manage to play four Xs in a square pattern on the board. A newcomer would never figure that out.
- The program contains eight nested “FOR” loops, effectively providing several levels of look-ahead. Whoever wrote this program was either a genius or was an early gamer with a lot of time on his hands, probably not a casual U of I student.
I believe I found the author. I was once poking around at a computer history site, and came across a reference to an early computer called the TX-0 having a 3-dimensional tic tac toe game. You can search Wikipedia, entering “TX-0” (the last character is a zero) as the subject, scroll down to the External Links, click on “TX-0 Documentation”, click on “Daly Thesis Feb61 Cubic”, and “mastersthesis.pdf”, you’ll find that there was a William George Daly Jr. who analyzed the game in 1953 as his masters thesis project at MIT! Other peer links show some source code in TX-0 assembler. (Google shows that someone by the same name in Duluth, GA was later named in six patent filings involving electronic circuits.)
If so, someone along the way translated the program from TX-0 assembler to BASIC.
I started translating the program from BASIC to Autocoder a while back, but ran into some issues:
- I never wrote in Autocoder. DeVry in Chicago taught us SPS-2 and machine code. I haven’t written an SPS-2 program for 40 years, though I still remember a lot about both. I even downloaded Rope, but had no 1401 simulator, and it would have taken more time than I had.
- One of the arrays in the program would likely require more than 1000 characters of memory, and I’m a little fuzzy on how adding a decimal subscript to the base address of an array larger than 1000 characters would be done.
- BASIC has GOSUB and RETURN statements, but the 1401 doesn’t support these – it has no stack. However, I believe I saw in your journal long ago a remark attributed to Ron Williams to the effect that when the 1401 takes a branch, the address of the next instruction (effectively the return address) is left in the “A Register”. If so, you could perform a GOSUB by executing a 1401 Branch instruction from the mainline program to the subroutine, put an unconditional Branch instruction at the end of the subroutine, and having the subroutine, as its first instruction, save the contents of the A Register to the operand of that last branch instruction in the subroutine (the last three characters of the subroutine, following the machine code “B” for the branch).
You could rig the program so that when the player decides on a move, he enters it via the sense switches (B through G). B and C would be the level, D and E would be the row, and F and G would be the column. So, for example, B and C down would be level 1, only C up would be level 2, only B up would be level 3, and both up would be level 4. If the user makes a mistake and wants to back up, he turns on the A switch (with the 1402 hopper empty) and the program backs out the previous move.
On each move, the printer could print a list of all moves ( a maximum of 32) by the player and the 1401 each, then execute an “F1”, kicking the printer up to the top of the next page (printing one page per move), and execute a Halt to allow the player to enter his next move.
I experimented with having the 1401 print a bunch of Xs and Os to represent the board on each move, but it looked like it couldn’t be done with a program that fit into 4000 characters of RAM. I could be wrong.
You would need to buy a Qubic board on eBay and label the squares. I suggest you remove the references to “strategy” from the game text.
Anyway, you can forward this to the others and see what they think. I wish I lived in your area. I’d be a regular there.
By the way, we used to play 3D tic tac toe on paper at the back of the classroom at DeVry like you did [in the Army]. Great minds think alike J. Don’t hesitate to send me correspondence.
Warren