- xLIBC Conway's Game of Life simulator
- 06 Jun 2015 08:11:43 pm
- Last edited by M. I. Wright on 08 Jun 2015 11:11:03 pm; edited 1 time in total
Just for fun! Finished in about an hour, although it's currently far too slow for my liking-- optimizations are more than welcome (especially for that augment()/seq() monstrosity in the middle of it).
Screenies:
Glider-- only loading 6 of the 16 total horizontal cells.
Loafer-- loading the entire field. Yes, it really is this slow.
[A] should be a 13x16 [that's 13 tall, 16 wide] matrix with its cells initialized according to the pattern you want; live cell is 1, a dead one is 0. The game doesn't modify the matrix, however (calculations are done by testing pixels), meaning that you can run the same pattern as many times as you want without changing [A].
If you want to start with a random field, replace 255[A](1+.1B,1+.1A) with 255real(8,3,2).
No download as of yet.
Code:
Screenies:
Glider-- only loading 6 of the 16 total horizontal cells.

Loafer-- loading the entire field. Yes, it really is this slow.

[A] should be a 13x16 [that's 13 tall, 16 wide] matrix with its cells initialized according to the pattern you want; live cell is 1, a dead one is 0. The game doesn't modify the matrix, however (calculations are done by testing pixels), meaning that you can run the same pattern as many times as you want without changing [A].
If you want to start with a random field, replace 255[A](1+.1B,1+.1A) with 255real(8,3,2).
No download as of yet.
Code:
real(0,1,1
real(7,9,0,0,160,120,0,1
real(7,9,0,0,160,120
For(A,0,60,10
For(B,0,110,10
real(7,3,A,B,255[A](1+.1B,1+.1A),10
End
End
real(9
While 1
For(A,0,60,10
For(B,0,110,10
real(8,1,not(real(8,0
real(7,1,A,B->E
{2,3}=sum(0 or augment(augment(seq(real(7,1,A-10,B+X),X,~10,10,10),seq(real(7,1,A,B+X),X,~10,10,20)),seq(real(7,1,A+10,B+X),X,~10,10,10->L6
real(8,1,not(real(8,0
real(7,3,A,B,255(E and max(L6) or L6(2)),10
End
End
real(9
End