I’ve been on a retro computer buying spree! Watch this.
Writing Conway’s Life for the MC-10 was an interesting exercise – it’s complex enough to not be trivial, to exercise a fair set of the language features, and to bump up against some of the machine’s limitations. It works pretty nicely, although holy CRAP does it need some optimization. You can download it, formatted for running on both emulators and real hardware here:
And here’s the Microcolor BASIC source code, for your interest.
10 REM MC-LIFE (C)2012 RINEY
20 CLEAR
30 W=63:H=31:AC=2:CX=1:CY=1:NC=0:PX=0:PY=0
35 INPUT "GRID SIZE(W,H - MAX IS 63,31)";IW,IH
36 IF W>=IW THEN W=IW
37 IF H>=IH THEN H=IH
40 DIM GR(H,W)
50 CLS
51 PRINT "RETICULATING SPLINES..."
55 GOSUB 7000
56 CLS
60 PRINT@237,"MC-LIFE"
70 PRINT@266,"PRESS ANY KEY"
80 A$=INKEY$:IF A$="" GOTO 80
90 CLS 0
110 GOSUB 2000
120 GOSUB 3000
130 GOTO 90
1000 REM INIT
1010 FOR Y=1 TO H
1020 FOR X=1 TO W
1025 A = RND(11)
1030 IF A>9 THEN GR(Y,X)=AC:GOTO 1040
1035 GR(Y,X)=0
1040 NEXT X,Y
1050 RETURN
1100 REM ZERO
1110 FOR Y=1 TO H
1120 FOR X=1 TO W
1130 GR(Y,X)=0
1140 NEXT X,Y
1150 RETURN
2000 REM DRAW
2010 FOR Y=1 TO H
2020 FOR X=1 TO W
2025 IF GR(Y,X)=AC THEN SET(X,Y,AC)
2040 NEXT X,Y
2999 RETURN
3000 REM UPDATE
3010 FOR CY=1 TO H
3020 FOR CX=1 TO W
3030 GOSUB 4000
3040 IF POINT(CX,CY)=AC THEN 3100
3050 IF NC=3 THEN GR(CY,CX)=AC
3060 GOTO 3900
3100 ON NC+1 GOTO 3200,3200,3300,3300,3400
3200 GR(CY,CX)=0:GOTO 3900
3300 GR(CY,CX)=AC:GOTO 3900
3400 GR(CY,CX)=0:GOTO 3900
3900 NEXT CX,CY
3999 RETURN
4000 REM NEIGHBOR COUNT
4005 NC=0
4010 PX=CX:PY=CY-1:GOSUB 6000
4020 PX=CX+1:PY=CY-1:GOSUB 6000
4030 PX=CX+1:PY=CY:GOSUB 6000
4040 PX=CX+1:PY=CY+1:GOSUB 6000
4045 IF NC=4 THEN RETURN
4050 PX=CX:PY=CY+1:GOSUB 6000
4055 IF NC=4 THEN RETURN
4060 PX=CX-1:PY=CY+1:GOSUB 6000
4065 IF NC=4 THEN RETURN
4070 PX=CX-1:PY=CY:GOSUB 6000
4075 IF NC=4 THEN RETURN
4080 PX=CX-1:PY=CY-1:GOSUB 6000
4999 RETURN
6000 REM WRAPPER
6010 IF PX=0 THEN 6100
6020 IF PX=W+1 THEN PX=1
6030 IF PY=0 THEN 6200
6040 IF PY=H+1 THEN PY=1
6050 GOTO 6300
6100 PX=W
6110 GOTO 6030
6200 PY=H
6300 IF POINT(PX,PY)=AC THEN NC=NC+1
6310 RETURN
7000 REM GLIDER
7005 GOSUB 1100
7010 GR(4,6)=AC
7020 GR(5,4)=AC:GR(5,6)=AC
7030 GR(6,5)=AC:GR(6,6)=AC
7040 RETURN
8000 REM BLINKER
8010 GOSUB 1100
8020 GR(3,3)=AC
8021 GR(3,4)=AC
8022 GR(3,5)=AC
8030 RETURN

