kestas.kuliukas.com

Game of Life for the Casio Color Power Graphic Calculator

This program is a simple Conway's Game of Life for Casio Graphic calculators.

Usage

Create matrix A and B, both 9x23. In matrix B enter the starting pattern; 1 is alive, 0 is dead.

Once you start the program it'll start processing from cycle to cycle. It takes ~30 seconds per cycle.

To stop it without messing up the pattern stop it while the current pattern is being draw, not while it's being processed.

Code

The -> represents the arrow under the red 'L' on your calculator, the one that assigns values to variables. The » represents the operator which executes the instruction to its right only if the instruction to its left equates to 1. (PRGM>JUMP>=>)
The whole program takes up 718 bytes, and could be cut down by cutting out the text and optimizing the code. The NOT= (used only once) represents the 'not equal' sign (the equal sign with a cross through it). (PRGM>REL>)

0 -> Z
Lbl 1
Z=0 ? Mat B -> Mat A
ClrText
For 1->Y To 7
For 1->X To 21
If Z:Then Mat A[Y,X]+Mat A[Y,X+1]+Mat A[Y,X+2]+Mat A[Y+1,X]+Mat A[Y+1,X+2]+Mat A[Y+2,X]+Mat A[Y+2,X+1]+Mat A[Y+2,X+2] -> N
If N <= 1 Or N >= 4:Then 0 -> Mat B[Y+1,X+1]:IfEnd
If N = 3:Then 1 -> Mat B[Y+1,X+1]:IfEnd
If N = 2:Then Mat A[Y+1,X+1]->Mat B[Y+1,X+1]:IfEnd
IfEnd
If Z = 0:Then Mat B[Y+1,X+1] ? Locate X,Y,"*":IfEnd
Next
Next
1-Z -> Z
Goto 1