2015-06-01 12:45:23 +00:00
|
|
|
"""
|
2015-06-04 18:16:25 +00:00
|
|
|
B3/S23: Game of Life
|
2015-06-01 12:45:23 +00:00
|
|
|
|
|
|
|
@author: jrpotter
|
|
|
|
@date: June 01, 2015
|
|
|
|
"""
|
2015-06-01 00:58:09 +00:00
|
|
|
if __name__ == '__main__':
|
2015-06-01 12:45:23 +00:00
|
|
|
|
|
|
|
import os, sys
|
|
|
|
sys.path.append(os.path.abspath('src'))
|
|
|
|
|
|
|
|
import cam
|
2015-06-06 23:07:52 +00:00
|
|
|
import cam_parser
|
2015-06-01 12:45:23 +00:00
|
|
|
|
2015-06-02 20:35:16 +00:00
|
|
|
c = cam.CAM(1, 100, 2)
|
2015-06-06 23:07:52 +00:00
|
|
|
p = cam_parser.CAMParser('B3/S23', c)
|
2015-06-02 20:35:16 +00:00
|
|
|
|
2015-06-14 00:55:51 +00:00
|
|
|
#c.randomize()
|
|
|
|
|
|
|
|
# Glider Gun 9x36
|
|
|
|
from bitarray import bitarray
|
|
|
|
row = [1<<11
|
|
|
|
,1<<13|1<<11
|
|
|
|
,1<<23|1<<22|1<<15|1<<14|1<<1|1<<0
|
|
|
|
,1<<24|1<<20|1<<15|1<<14|1<<1|1<<0
|
|
|
|
,1<<35|1<<34|1<<25|1<<19|1<<15|1<<14
|
|
|
|
,1<<35|1<<34|1<<25|1<<21|1<<19|1<<18|1<<13|1<<11
|
|
|
|
,1<<25|1<<19|1<<11
|
|
|
|
,1<<24|1<<20
|
|
|
|
,1<<23|1<<22
|
|
|
|
]
|
|
|
|
|
|
|
|
for i in range(9):
|
|
|
|
c.master.grid[35+i][12:48] = bitarray(bin(row[i])[2:].zfill(36))
|
|
|
|
|
2015-06-18 01:04:59 +00:00
|
|
|
c.start(cam.CAM.Show.CONSOLE, clock=50, rules=p.ruleset)
|