This is a conversion to Micro Color BASIC of a game by Clyde Perkins for the Bally Arcade/Astrocade game console and early 8-bit home computer. The first "Bally BASIC" version appeared in the Arcadian 2, no. 5, March 24, 1980. The "AstroBASIC" version was released on the "Best of Arcadian, 1980" tape. I took the source for my port from Arcadian Vol 5 No2, Dec 1982. Perkins' game is an early version of Othello or the game of Reversi with an AI opponent created in BASIC. It also allows for a game between two human players, and it does this on an MC-10 computer with only 4K of memory! Amazing!
Thanks to the Bally Alley folks for their helpful playthrough:
https://youtu.be/DR6gyQvdR8I?si=LtfETxYljqeicxtL
There's nothing much to report about this port regarding differences in BASIC. The only real bump regards the diabolically hard translation of AstroBASIC graphics, which are laid out as a grid with the 0/0 coordinates located at the centre of the screen. The graphics are 160 by 88 pixels:
44
|
-80 --- 0,0 --- 80
|
-44
I had to do some fancy math to translate everything to a more common graphic grid starting in the upper left corner and then scale it for the MC-10 low res 64 X 32 Semigraphics-4 screen. Otherwise, BallyBASIC is pretty straightforward. Quite nice in a lot of ways, although very memory restricted. That's okay though, because it means we now have another board game to add to the BASIC Checkers sold by Tandy for the 4K MC-10. Source code can be found here:
https://github.com/jggames/trs80mc10/tree/master/quicktype/Board%20Games/OJello
I'll post an addendum here when I have a chance to think about the project a little more.
Addendum.
I think I found a bug in the original program. When I printed the move-weighting table consulted by the AI via its lookup algorithm for reading the table data from a single index array this is what came out:
5 3 99 2 2 99 3 5
15 8 2 -15 -15 2 8 15
0 1 15 0 0 15 1 0
9 5 8 1 1 8 5 9
9 5 8 1 1 8 5 9
0 1 15 0 0 15 1 0
15 8 2 -15 -15 2 8 15
5 3 99 2 2 99 3 5
When my son Charlie came home for Christmas he looked at the routine that generates the table and also came up with this arrangement using a modern programming language. It seemed obvious to us that the corners were what should be prioritized with the 99 weights and that there were other weird asymmetries going on.
I'm not 100% sure if there is something I did in my port, or something different about the BASICs, which can account for this mixed up table. Apparently Perkins worked from an article in Byte magazine, but we couldn't find anything in the earliest article from 1977 (see refs at bottom) presenting a BASIC version of Othello. Eventually Charlie figured out that there was a problem with decimal points in the lookup algorithm in line 510 of our test routine below. This test program includes Perkins' routine (56-57) for generating and storing the 8X8 weighting table in a single index array variable A(2-66) and then uses the lookup algorithm from the program (510) to consult every space on the 8X8 board using the coordinate system for plotting pieces (500):
REM Perkins' original table generating routine for populating the array
0 DIMA(70):A(0)=-1:A(1)=-1:REM first two elements reserved for storing player scores56 A(2)=3:A(3)=5:A(4)=1:A(5)=8:A(7)=9:A(8)=0:A(9)=15:A(12)=-15:A(13)=2:A(17)=9957 FORX=0TO3:FORY=0TOX:FORZ=2TO50STEP16:FORW=1TO4STEP3:A(X*W+Y*(5-W)+Z)=A(X+Y*4+2):NEXTW,Z,Y,X59 C=0:FORY=1TO8:FORX=1TO8:PRINTA(2+C);:C=C+1:NEXT:PRINT:NEXT:STOPREM My modified lookup algorithm tailored for the MC-10 screen (jumps by 8s instead of 9s in the vertical) and with Charlie's -4 and -5 fudge factor)
500 FORB=28TO-28STEP-8:FORA=-35TO35STEP10510 O=(ABS(B)-4)/8*4+(ABS(A)-5)/10+2+32*-(B<0)+16*-(A<0):R=A(O):PRINTR;:NEXT:PRINT:NEXT:PRINTREM The original lookup and plotting algorithms
500 FORB=-31TO32STEP9:FORA=-35TO35STEP10510 O=ABS(B)/9*4+ABS(A)/10+2+32*-(B<0)+16*-(A<0):R=A(O):PRINTR;:NEXT:PRINT:NEXT:PRINT
Charlie's algorithm for the win! |
- Duda, Richard O (October 1977). "Othello, a New Ancient Game". BYTE: 60–62.
- Wright, Ed (November–December 1977). "Othello". Creative Computing: pp. 140–142.
- Frey, Peter W (July 1980). "Simulating Human Decision-Making on a Personal Computer". BYTE: pp. 56.
No comments:
Post a Comment