Optimize a Conway's Game of Life Program

OneLetterShor 25 May 2020 23:39

```
ClrHome
{11,28}→dim([A])
For(A,2,10)
For (B,2,27)
max(0,randInt(⁻3,1))→[A](A,B)
Output(A,B-1),"O")
End:End
0→G
Output(1,1,"GENERATION")
Output(1,16,"MEMBERS=")
Repeat getKey or M=0
G+1→G
For(A,2,10)
For(B,1,26)
Output(A,B,sub(" O",[A](A,B+1)+1,1))
End:End
Output(1,12,G)
Output(1,24," ") //four spaces
[A]→[B]
0→M
For(A,2,10)
For(B,2,27)
Output(A,B-1,"θ")
If [A](A,B)=1:M+1→M
Output(1,24,M)
0→N
For(C,-1,1)
For(D,-1,1)
If [A](A+C,B+D) and 2≠sum(not({C,D}≠0)):N+1→N
End:End
If N=3 and [A](A,B)=0
1→[B](A,B)
If [A](A,B)=1 and N≠2 and N≠3
0→[B](A,B)
Output(A,B-1,sub(" O",[A](A,B)+1,1))
End:End
[B]→[A]
End
```