def __init__(self): logging.info('script started') lg_envmt = lifegenes_environment() lg_envmt.drawColor() logging.info('setup complete; beginning evolution cycles') try: while(True): #until stopped by golly g.show('cells moving') for i in range(5): # rounds of cell movement #logging.debug('movement round '+str(i)) lg_envmt.cellMotions() #logging.debug('cells moved') lg_envmt.drawColor() #logging.debug('cells recolored') g.update() #logging.debug('golly updated') #time.sleep(1) g.show('cells evolving') # one round of evolution: #logging.debug('evolution round started') g.step() #g.update() #logging.debug('golly evolution complete') lg_envmt.update() #logging.debug('cellList updated') lg_envmt.drawColor() #logging.debug('cells recolored') g.update() #logging.debug('golly updated') #time.sleep(1) finally: logging.info('cycling halted from external source (probably golly)') g.show('closing gracefully, hold on just a sec...') lg_envmt.teardown()
def __init__(self): logging.info('script started') lg_envmt = lifegenes_environment() lg_envmt.drawColor() logging.info('setup complete; beginning evolution cycles') try: while(True): #until stopped by golly g.step() #g.update() lg_envmt.update() lg_envmt.drawColor() g.update() finally: logging.info('cycling halted from external source (probably golly)') g.show('closing gracefully, hold on just a sec...') lg_envmt.teardown()
# this script creates a cell genome for each cell in the current layer, # and then displays the genetic 'color' of each cell by creating another # layer using the custom rule 'constant.table' which allows for 255 # unchanging states (and thus a nice range of colors). # Please see the [LifeGenes project for genetic cellular automaton](https://github.com/7yl4r/LifeGenes) for more info. from LifeGenes.lifegenes_core.environment import environment as lifegenes_environment from LifeGenes.lifegenes_core.setupLog import setupLog import logging setupLog('drawColors.log') import golly as g lg_envmt = lifegenes_environment() lg_envmt.drawColor()
def __init__(self): try: g.show('setting up test') testSize = 100 #this is the size of one side of the square testing area g.select([-testSize/2,-testSize/2,testSize,testSize]) #clear the canvas g.clear(1) g.clear(0) g.randfill(50) g.update() g.show('stressTest started') startTime = time() lg_envmt = lifegenes_environment() endTime = time() logging.debug('\tsetup t\t=\t\t'+str(endTime-startTime)) g.update() startTime = time() lg_envmt.drawColor() endTime = time() logging.debug('\tcolorDraw t\t=\t' + str( endTime - startTime)) g.update() startTime = time() lg_envmt.cellMotions() endTime = time() logging.debug('\tmovement t\t=\t' + str( endTime - startTime)) g.update() startTime = time() lg_envmt.drawColor() endTime = time() logging.debug('\tcolor update t \t= ' + str( endTime - startTime)) g.update() g.step() startTime = time() lg_envmt.update() endTime = time() logging.debug('\tevolve update t\t= ' + str( endTime - startTime)) startTime = time() lg_envmt.cellMotions() endTime = time() logging.debug('\tmovement t\t=\t' + str( endTime - startTime)) g.update() startTime = time() lg_envmt.drawColor() endTime = time() logging.debug('\tcolor update t\t= ' + str( endTime - startTime)) g.update() g.update() g.show('test complete') finally: logging.info('cycling halted from external source (probably golly)')