Made a Unit Cell grid creator for Game of Life

For scripts to aid with computation or simulation in cellular automata.
Post Reply
Naszvadi
Posts: 388
Joined: May 7th, 2016, 8:53 am
Contact:

Made a Unit Cell grid creator for Game of Life

Post by Naszvadi » December 9th, 2016, 10:08 am

Hi!

Created a python garbage, which converts an rle format GoL pattern file to rle format embedding the pattern into a grid of unit cells made by David Bell. Each unit cell has a size of 500x500.

Enjoy! Well, it does not depend on Golly's libs.

For getting summary of options, run with "-h" parameter, like:

Code: Select all

# unitcell.py -h
The code is:

Code: Select all

#!/usr/bin/env python
import getopt,re,sys
unitcell = [
    [ '2o495b2ob' ],
    [ 'obo493bobob' ],
    [ 'bobo491bobo2b' ],
    [ '2bo493bo3b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '191b2o307b' ],
    [ '191bo308b' ],
    [ '178bo10bobo103b2o203b' ],
    [ '177bobo9b2o104bo204b' ],
    [ '136bo38b2o3bo106bo5bobo204b' ],
    [ '134b3o33b2o3b2o3bo105b4o3b2o205b' ],
    [ '133bo36b2o3b2o3bo104b2obobo209b' ],
    [ '133b2o42bobo94b2o8b3obo2bo208b' ],
    [ '178bo95b2o9b2obobo209b' ],
    [ '286b4o210b' ],
    [ '131bo155bo212b' ],
    [ '130bobo367b' ],
    [ '129bo3bo366b' ],
    [ '130b3o250b2o115b' ],
    [ '128b2o3b2o248b2o115b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '382b3o115b' ],
    [ '381bo3bo114b' ],
    [ '131b2o247bo5bo83b2o28b' ],
    [ '131b2o247bo5bo83b2o28b' ],
    [ '383bo116b' ],
    [ '381bo3bo114b' ],
    [ '366b2o14b3o115b' ],
    [ '366b2o15bo116b' ],
    [ '500b' ],
    [ '380b2o118b' ],
    [ '381bo118b' ],
    [ '378b3o119b' ],
    [ '366b3o9bo121b' ],
    [ '366b3o131b' ],
    [ '365bo3bo99b5o26b' ],
    [ '402bobo63bob3obo25b' ],
    [ '364b2o3b2o23b3o5bo3bo62bo3bo26b' ],
    [ '389b2o2bo2bobo7bo63b3o27b' ],
    [ '387bo2bo2b2o7bo4bo4b2o57bo28b' ],
    [ '386bo8bo10bo5b2o86b' ],
    [ '386bo11b2o2bo3bo93b' ],
    [ '386bo9bo5bobo95b' ],
    [ '380b2o5bo2bo5b2o75bo26b' ],
    [ '379bobo7b2o3bobo76bo26b' ],
    [ '379bo14b3o69bo5bobo25b' ],
    [ '369b2o7b2o86bobo2b2ob2o24b' ],
    [ '369bo96b2o2bo5bo23b' ],
    [ '370b3o100bo26b' ],
    [ '372bo97b2o3b2o23b' ],
    [ '413b2o21b2o62b' ],
    [ '401b3o2bo5bo3bo19b2o62b' ],
    [ '397bo3bo9bo5bo3b2o77b' ],
    [ '395bobo4bo8bo3bob2o2b2o77b' ],
    [ '393b2o16bo5bo82b' ],
    [ '30bo362b2o17bo3bo83b' ],
    [ '30b3o200bo159b2o18b2o85b' ],
    [ '33bo197bobo37bo30bo86b2o4bobo102b' ],
    [ '32b2o189b2o4b2o40b3o28b3o83bobo6bo102b' ],
    [ '223b2o4b2o43bo30bo82bo78bo8bo23b' ],
    [ '229b2o31b2o9b2o29b2o81b2o45b2obob2o25b2o7b3o22b' ],
    [ '34b3o194bobo8b2o18b2o200bo3bo5b5o21b' ],
    [ '34b3o196bo8bobo189bo5bo22bob2o6bobobobo20b' ],
    [ '33bo3bo206bo61b3o147b2o5bobo7b2o3b2o20b' ],
    [ '32bo5bo187bo17b2o60b3o126b2ob2o15bobo42b' ],
    [ '33bo3bo187bobo77bo3bo127bo17bo44b' ],
    [ '34b3o178b2o6b2o3bo44b2obob2o174b2o8b2o7b2o25b' ],
    [ '214bobo4b2obo3bo44bo5bo24b2o3b2o133bo19b2o7b2o25b' ],
    [ '213b3o4b3obo3bo45bo3bo150b2o12bo28bo27b' ],
    [ '204b2o6b3o4bo2b2obobo8b2o37b3o144b3o4b2o12b3o6b2o18b3o25b' ],
    [ '204b2o7b3o4b2o4bo9bobo182b5o6b2o18b2o22bo23b' ],
    [ '214bobo21bo20b2o3b2o154bobo3bo5b3o37b5o23b' ],
    [ '215b2o21b2o180b2o3bo6b2o7b3o30b2o24b' ],
    [ '260bo3bo147b2o15b2o69b' ],
    [ '32b2o195bo31b3o149bo15b2o69b' ],
    [ '33bo193bobo31b3o149bobo7bo47b2o3b2o22b' ],
    [ '30b3o195b2o44bo34b2o103b2o7bobo46b5o23b' ],
    [ '30bo242bo35bo116b2o4b2o18bo19b2ob2o23b' ],
    [ '223b2o48b3o34b3o95b2o16b2o4b2o17b3o18b2ob2o23b' ],
    [ '138b2o82bobo87bo95b2o16b2o22b5o18b3o24b' ],
    [ '139bo72bo11bo198bobo23bobobobo44b' ],
    [ '139bobo9bo60bobo45bo162bo25b2o3b2o44b' ],
    [ '140b2o8b2o49b2o12b2o9b2o31b3o238b' ],
    [ '42bo106b2o4b2o44b2o12b2o9b2o31b3o14b5o219b' ],
    [ '42b3o103b3o4b2o2b2o54b2o6b2o42b2o6bob3obo218b' ],
    [ '45bo103b2o4b2o2b2o51bobo7b3o32b2o3b2o3b2o7bo3bo127b3o62b2o25b' ],
    [ '44b2o104b2o60bo10b2o32b2o3b2o13b3o127b2ob2o61b2o25b' ],
    [ '151bo74b2o5b2o43bo128b2ob2o18b2o22b2o44b' ],
    [ '226b2o5bobo171b5o17bobo22bo45b' ],
    [ '235bo8bo29bo5b2o124b2o3b2o17bo24b3o42b' ],
    [ '235b2o5bobo27bobo5bo159bo16bo42b' ],
    [ '226bo16b2o28b2o6b3o156b2o58b' ],
    [ '226bobo33b2o19bo151b2o4b2o57b' ],
    [ '44b2o3b2o158b2o18b2o31bo147bo24b2o4b3o7b2o47b' ],
    [ '47bo159bo3bo17b2o32b3o144bo20bo3b2o4b2o8b2o47b' ],
    [ '44bo5bo155bo5bo16b2o34bo145bo18b3o7b2o58b' ],
    [ '45b2ob2o151b2o2b2obo3bo8bo4bobo4b2o168b2o24bo3bo6bo59b' ],
    [ '46bobo152b2o3bo5bo9bo3bo6bobo165bo2bo5bo13b2o2bob3obo65b' ],
    [ '47bo159bo3bo5bo2b3o12bo164bo9bo13b2o3b5o66b' ],
    [ '47bo67bo93b2o24b2o155b2o6bo13b2o84b' ],
    [ '114bobo275b2o6bo12bobo8bo75b' ],
    [ '115bobo283bo2bo9bo8bobo74b' ],
    [ '116bobo104b2o178b2o18bobo74b' ],
    [ '117b2o103bobo199bo75b' ],
    [ '46b2o176bo4bo29bo29bo210b' ],
    [ '46b2o179bobo27bobo27bobo210b' ],
    [ '228b2o28b2o28b2o131b2obob2o72b', '120b3o105b2o28b2o28b2o131b2obob2o72b' ],
    [ '208bobo210bo5bo72b', '122bo85bobo210bo5bo72b' ],
    [ '207bo2bo3b2o206bo3bo73b', '121bo85bo2bo3b2o206bo3bo73b' ],
    [ '198b2o6b2o5b3ob2o2b2o200b3o4b2o68b' ],
    [ '125b2o71b2o4b2o3bo3bo3bo3bobo206b2o68b' ],
    [ '125bobo78b2o5bobo8bo275b' ],
    [ '126bobo78bo2bo2b2o6bo2bo275b' ],
    [ '127bobo78bobo13bo275b' ],
    [ '128bo92bobo6b2o268b' ],
    [ '221b2o7bobo193b2o72b' ],
    [ '232bo148bo4bo39bo73b' ],
    [ '232b2o145b2ob4ob2o38b3o70b' ],
    [ '222bobo156bo4bo42bo70b' ],
    [ '221bo2bo19bo29bo29bo195b' ],
    [ '211bo8b2o20bobo27bobo27bobo195b' ],
    [ '210bobo5b2o3bo19b2o28b2o28b2o195b' ],
    [ '210b2obo6b2o278b' ],
    [ '198b2o10b2ob2o6bo2bo5b2o268b' ],
    [ '198b2o10b2obo8bobo5bobo154bo112b' ],
    [ '210bobo19bo102b2o48bobo112b' ],
    [ '211bo20b2o102bo46b2o115b' ],
    [ '336bobo6bo37b2o115b' ],
    [ '163b2o57b2o113b2o4bobo37b2o115b' ],
    [ '163b2o57b2o118bobo34b2o4bobo112b' ],
    [ '160b2o10bo4bo163bo2bo11b2o20bobo6bo112b' ],
    [ '148bobo8b3o10bo4bobo162bobo11b2o20bo121b' ],
    [ '148bo3bo7b2o10bo7b2o13b2o146bobo31b2o16b2o3b2o98b' ],
    [ '132bo19bo10b2o2b2o11b2o14bo148bo49b2o3b2o98b' ],
    [ '130b4o14bo4bo9b2o2bo2b2o8b2o14bobo5b2o9b3o11bo29bo29bo29bo76b5o19b2o78b' ],
    [ '129bobob2o4bo12bo15b4o5bobo4b2o11b2o5bo2bo9bo9bobo27bobo27bobo27bobo77bobo21bo78b' ],
    [ '124b2o2bo2bob3o5b2obo3bo3bo16bo7bo6bobo21bo7bo5bo5b2o28b2o28b2o28b2o101bobo6bo69b' ],
    [ '124b2o3bobob2o5b4obo2bobo35bo21bo12b4o172b3o22b2o4bobo69b' ],
    [ '130b4o6b2o2b2o40b2o20bo11b2obobo200b2o18b2o52b' ],
    [ '132bo36b2o9b2o22bo2bo11b3obo2bo199b2o17bo3bo50b' ],
    [ '25b2o6b2o125bobo5bo2bo2b3o2bo2bo21b2o14b2obob2o199b2o16bo5bo49b' ],
    [ '24bo2bo4bo2bo124b2o6b3o2b5o2b3o38b4ob3o166b2o31bobo4bo8bo3bob2o2b2o44b' ],
    [ '24bo2bo4bo2bo125bo9b9o42bo4bobo166bo33bo3bo9bo5bo3b2o44b' ],
    [ '24bo2bo4bo2bo134bo9bo48bo163b3o38b3o2bo5bo3bo50b' ],
    [ '25b2o6b2o115bobo17b2o7b2o48b2o162bo52b2o52b' ],
    [ '151b2o347b' ],
    [ '151bo348b' ],
    [ '500b' ],
    [ '162b4o26b4o26b4o26b4o26b4o26b4o26b4o26b4o26b4o94b' ],
    [ '161bo3bo25bo3bo25bo3bo25bo3bo25bo3bo25bo3bo25bo3bo25bo3bo25bo3bo21b2o71b' ],
    [ '136b2o27bo29bo29bo29bo29bo29bo29bo29bo29bo21b2o71b' ],
    [ '137bo23bo2bo26bo2bo26bo2bo26bo2bo26bo2bo26bo2bo26bo2bo26bo2bo26bo2bo95b' ],
    [ '137bobo4bo8bo2bo285bo57b' ],
    [ '138b2o3bobo10bo282b4o57b' ],
    [ '141b2o3bo5b2o3bo2bo57b2o206b2o10b4o9b2o47b' ],
    [ '37b2o102b2o3bo4bobob2o3b4o54bo207bobo9bo2bo9b2o47b' ],
    [ '38bo102b2o3bo14b4o5b2o35b2o7bobo198b3ob2o4b3o8b4o5bo52b' ],
    [ '35b3o56b2o47bobo5b2o8bo2bo5b2o35b3o6b2o4b3o27b3o27b3o27b3o102b4o2bo4b3o8b4o4bo52b' ],
    [ '35bo56bo3bo47bo16b4o28bo15b2obo11bo29bo29bo29bo106b2o4b3o12bo57b' ],
    [ '91bo5bo13b2o47b4o27bobo4b3o8bo2bo10bo29bo29bo29bo112bobo71b' ],
    [ '86b2o2b2obo3bo13b2o47bo29bobo16b2obo213b2o72b' ],
    [ '86b2o3bo5bo10b2o74b2o3bo2bo7bo2b2o2b3o290b' ],
    [ '92bo3bo10b3o74b2o4bobo7bo3bo2b2o291b' ],
    [ '94b2o12b2o81bobo6bo2bo296b' ],
    [ '99bobo9b2o5b2o73bo8b2o296b' ],
    [ '99b2o10b2o5bobo379b' ],
    [ '100bo19bo379b' ],
    [ '120b2o378b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '196b2o9b3o11b2o14b3o27b3o27b3o200b' ],
    [ '105b2o9bo71bo7bo2bo9bo11bo17bo29bo29bo200b' ],
    [ '104b4o7bobo69bo3b2o7bo7bo5bo4bobo16bo29bo29bo201b' ],
    [ '99bobo2bo2b3o5b2obo68bo5bo6bo12b4ob3o279b' ],
    [ '98bo2bo2b2o9b2ob2o3b2o63b5o7bo11b2obob2o281b' ],
    [ '97b2o9bo6b2obo4b2o71bo2bo11b3obo2bo281b' ],
    [ '95b2o3bo8bo5bobo78b2o14b2obobo282b' ],
    [ '67bo16bobo10b2o10bo6bo96b4o283b' ],
    [ '62b3ob2o2b2o12b2o5b2o5bo2bo112bo285b' ],
    [ '62b4o4b2o13bo4bobo6bobo119b2o277b' ],
    [ '66b2o22bo130bo278b' ],
    [ '89b2o119bobo6bobo278b' ],
    [ '208bo3bo6b2o279b' ],
    [ '200bo7bo291b' ],
    [ '199b4o4bo4bo287b' ],
    [ '198b2obobo4bo13b3o27b3o27b3o215b' ],
    [ '160bo26b2o8b3obo2bo3bo3bo11bo29bo29bo215b' ],
    [ '158b3o26b2o9b2obobo6bobo10bo29bo29bo216b' ],
    [ '157bo41b4o297b' ],
    [ '157b2o41bo299b' ],
    [ '23bo187bo288b' ],
    [ '19b2o2b2ob3o34b2o144bobo288b' ],
    [ '19b2o4b4o26bo7bobo3bobo138b2o288b' ],
    [ '23b2o30b3o5bo5b2o429b' ],
    [ '13b2o15b3o25bo11bo143b2o284b' ],
    [ '13b2o17bo24b2o131b2o22b2o284b' ],
    [ '31bo159bo308b' ],
    [ '36bo154bobo6bobo21b2o47b2o225b' ],
    [ '34b3o155b2o5bo2bo3b2o16bo48b3o224b' ],
    [ '33bo50bo68b5o31bo8b2o5b3ob2o2b2o7bobo275b' ],
    [ '33b2o49b3o65bob3obo28b3o6b2o3bo3bo3bo3bobo6b2o13b3o27b3o5b3o222b' ],
    [ '12b3o72bo65bo3bo28bo11b2o5bobo8bo22bo29bo5bob2o221b' ],
    [ '11b2ob2o50bo19b2o66b3o29b2o11bo2bo2b2o6bo2bo21bo29bo6b4o221b' ],
    [ '11b2ob2o50b3o86bo44bobo13bo25b2o256b' ],
    [ '11b5o4b2o47bo143bobo27bo256b' ],
    [ '10b2o3b2o22bo2bob2obo2bo17b2o143b2o28bobo5bobo246b' ],
    [ '20bo2bo15b4ob2ob4o27b2o8b3o27b2o104b2o18b2o3bo3bo5b3o238b' ],
    [ '24bo5b3o6bo2bob2obo2bo27bobo6b2ob2o26bo35b2o68bo24bo7bobo2bo2b2o233b' ],
    [ '16bo5bo6bo3bo44bo8b2ob2o24bobo35b2o27b3o4b2o25bo4bobo23bo4bo7b2o2bo2bo15b2o9b2o183b2o18b' ],
    [ '15bob2o9bo5bo52b5o24b2o23bo40bo3bo4bo24bobo3b2o25bo19bo13b2o9bobo183bo19b' ],
    [ '15bo12bo5bo51b2o3b2o46b3o49bobo5b2o15b2obo29bo3bo2b3o10bo8bo6bo7b3o174b2o6bobo19b' ],
    [ '79b2o57bo42bo5bo4b2o5bobo14b2ob2o30bobo15bo7bobo12b3o174bobo5b3o20b' ],
    [ '15b2obo9bo41b3o5bobo57b2o41b2o3b2o14bo13b2obo45bo2bo6b2o3bo12b3o163b2o7bo6b3o22b' ],
    [ '13bo2bo11b2o39bo3bo6bo5bo112bo2bo13bobo46b2o8b2o3bo13bobo5b2o155b2o7bo2bo2bo2bo22b' ],
    [ '13bobo12b2o38bo5bo9b2obo114bo8bo5bo57b2o3bo14b2o5bobo163bo6b2o23b' ],
    [ '27b2o2bo36bo5bo12bo20b2o74bo14bobo7bobo10b3o52bobo24bo164bobo28b' ],
    [ '28bobo76bobo73bobo13b2o9b2o12bo53bo25b2o164b2o28b' ],
    [ '29b2o43bo9bob2o21bo26bo46bobo37bo276b' ],
    [ '73b2o11bo2bo45b3o47bo314b' ],
    [ '14b3o56b2o12bobo44b5o46bo314b' ],
    [ '13bo3bo8b2o3b2o38bo2b2o57bobobobo42bo2bo314b' ],
    [ '12bo5bo7b2o3b2o39bobo58b2o3b2o43b2o32b2o116bo164b' ],
    [ '13bo3bo54b2o38b2o103b2o116b3o162b' ],
    [ '14b3o11b3o69b3o8b3o40b2o182bo161b' ],
    [ '14b3o11b3o55b3o13bo5bob2o24bo17bo49bo22b2o108b2o161b' ],
    [ '29bo40b2o3b2o8bo3bo11bo6bo2bo4b3o16bob2o4b2o7bobo49bobo20bo272b' ],
    [ '70b2o3b2o7bo5bo17bob2o5bob2o14bo7bobo6b2o39b2o12b2o9b2o5bobo272b' ],
    [ '85bo3bo13b2o6b3o3bob2o15bo2bo6bo46b2o12b2o9b2o5b2o273b' ],
    [ '15b2o55b3o11b3o13bobo7b2o4bobo19bo2bo2bo60b2o6b2o283b' ],
    [ '15b2o55b3o11b3o13bo35b2o6bo57bobo7b3o283b' ],
    [ '73bo19b2o6b2o40bobo16bo41bo10b2o120b2o3b2o156b' ],
    [ '28b2o54b2o6bobo48b2o15b3o55b2o120bo159b' ],
    [ '28b2o55bo8bo22b2o3b2o35bo58b2o117bo5bo156b' ],
    [ '82b3o35bo38b2o30b2o145b2ob2o157b' ],
    [ '70b2o10bo34bo5bo67bo147bobo158b' ],
    [ '71bo46b2ob2o33b3o21bobo6bobo148bo9bobo147b' ],
    [ '68b3o48bobo34b3o21bo3bo4b2o149bo8bo2bo147b' ],
    [ '68bo51bo34bo3bo24bo163b2o150b' ],
    [ '85b3o32bo33bo5bo9b2o8bo4bo160b2o3bo82bo65b' ],
    [ '87bo67bo3bo10b2o12bo163b2o82b3o65b' ],
    [ '76bo9bo10b2o57b3o21bo3bo164bo2bo5b2o71bo68b' ],
    [ '75bobo19bo19b2o61bobo167bobo5bobo70b2o67b' ],
    [ '63b2o10b2obo8bobo5bobo20bo241bo47bo91b' ],
    [ '63b2o10b2ob2o6bo2bo5b2o18b3o13bo70b2o19b2o135b2o44b3o91b' ],
    [ '75b2obo6b2o28bo13bobo43b2o26bo19bo128bo52bo94b' ],
    [ '75bobo5b2o3bo39bobo44bo27bobo7b2o6bobo126b3o52b2o22bo70b' ],
    [ '76bo8b2o40bo2bo10bo26bo4bobo28b2o5bo2bo6b2o126bo77b2ob2o35b2o19b2o10b' ],
    [ '86bo2bo38bobo11bo24bobo3b2o35bo138b2o117bo19bo11b' ],
    [ '87bobo34b2o3bobo10bo13b2o9b2obo39bo6bo208bo5bo35bobo6bo8bobo11b' ],
    [ '123bobo5bo35b2ob2o38bo7b2o127bo121b2o6b4o5b2o12b' ],
    [ '123bo43b2obo40bo2bo131bobo77b2obob2o45b4o18b' ],
    [ '122b2o43bobo13bo29b2o130bo3bo128bo2bo18b' ],
    [ '168bo12b3o161b5o128b4o18b' ],
    [ '180bo163b2o3b2o49b2o3b2o70b4o19b' ],
    [ '181bo163b5o51b5o71bo22b' ],
    [ '178bo2bo164b3o52b2ob2o94b' ],
    [ '139b5o33bo169bo53b2ob2o94b' ],
    [ '138bob3obo31bo3bo221b3o21b2o72b' ],
    [ '139bo3bo34bo248bo72b' ],
    [ '140b3o32bo5bo242b3o73b' ],
    [ '141bo33bo5bo242bo75b' ],
    [ '176bo3bo219b2o98b' ],
    [ '138b2o37b3o221bo98b' ],
    [ '139bo204b2o52b3o99b' ],
    [ '136b3o13b2o191bo52bo101b' ],
    [ '136bo15bobo41b2o144b3o155b' ],
    [ '153b3o40bo145bo157b' ],
    [ '154b3o32bo4bobo303b' ],
    [ '153b3o32b4ob3o50b2o20b2o230b' ],
    [ '145b2o5bobo32b2obob2o53bo20bo231b' ],
    [ '144bobo5b2o32b3obo2bo53bobo6b2o8bobo231b' ],
    [ '144bo42b2obobo55b2o6bo2bo6b2o232b' ],
    [ '143b2o43b4o12bo55bo239b' ],
    [ '161b3o25bo12b3o48bo6bo239b' ],
    [ '160bo3bo36bo49b2o7bo239b' ],
    [ '201b2o53bo2bo240b' ],
    [ '159bo5bo90b2o242b' ],
    [ '159b2o3b2o334b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '196b2o3b2o297b' ],
    [ '159b2o36b5o298b' ],
    [ '160bo36b2ob2o298b' ],
    [ '157b3o12bo24b2ob2o298b' ],
    [ '108bo9b2o37bo12b4o24b3o16b2o281b' ],
    [ '107bobo7b4o48bobob2o42bo282b' ],
    [ '106bob2o6bobobo2bobo42bo2bob3o31bobo5bobo282b' ],
    [ '100b2o3b2ob2o7b2ob2obo2bo41b2obob2o31bo2bo5b2o283b' ],
    [ '100b2o4bob2o7b2obo5b2o38b3ob4o31b2o293b' ],
    [ '107bobo8b2o4bo3b2o35bobo4bo30b2o3bo291b' ],
    [ '108bo7b3o7b2o37bo39b2o293b' ],
    [ '118bo4bo2bo5b2o30b2o40bo2bo290b' ],
    [ '116bo6bobo6bobo72bobo290b' ],
    [ '117b2o15bo365b' ],
    [ '134b2o46b3o315b' ],
    [ '181bo3bo314b' ],
    [ '180bo5bo313b' ],
    [ '180bo5bo313b' ],
    [ '100b2o9b2o70bo29b2o285b' ],
    [ '100bobo9b2o67bo3bo25bo2bo285b' ],
    [ '91b3ob2o4b3o7bo6bo65bo11bo7bo5bo7b5o277b' ],
    [ '91b4o2bo4b3o12bobo60bo2bo10b4o5b2o5bo6bo5bo276b' ],
    [ '95b2o4b3o12bo3b2o58bo12bobob2o4b2o5bo7b2o3bo276b' ],
    [ '100bobo13bo3b2o40bo18bo10bo2bob3o11bo2bo7bo277b' ],
    [ '100b2o14bo3b2o40b3o13b3o11b2obob2o14b2o285b' ],
    [ '117bobo3b2o40bo12bo11b3ob4o302b' ],
    [ '34bo83bo4bobo38b2o23bobo4bo303b' ],
    [ '34b3o88bo63bo25bo284b' ],
    [ '37bo87b2o41bo19b2o25b3o282b' ],
    [ '36b2o130bo49bo281b' ],
    [ '191bo17b2o6b2o281b' ],
    [ '38b3o150b3o15bobo288b' ],
    [ '38b3o123b2o3b2o23bo14bo290b' ],
    [ '37bo3bo123b5o23b2o305b' ],
    [ '36bo5bo123b3o331b' ],
    [ '20bo16bo3bo125bo332b' ],
    [ '20b3o15b3o459b' ],
    [ '23bo171b3o302b' ],
    [ '22b2o170b2ob2o17b3o281b' ],
    [ '194b2ob2o17bo19b2o262b' ],
    [ '194b5o18bo18b2o262b' ],
    [ '40b2obo149b2o3b2o300b' ],
    [ '41b2o121b2o334b' ],
    [ '165bo334b' ],
    [ '22b2o3b2o133b3o46b2o23bo263b' ],
    [ '22bo5bo133bo48b2o11b2o9b3o262b' ],
    [ '224bobo7bo3bo261b' ],
    [ '23bo3bo2b2o192bo8bob3obo260b' ],
    [ '24b3o4b2o8bo192b5o261b' ],
    [ '30bo9b3o155b2o300b' ],
    [ '39b5o154bo301b' ],
    [ '38bobobobo154b3o72bobo223b' ],
    [ '38b2o3b2o156bo70bo3bo223b' ],
    [ '231b3o38bo227b' ],
    [ '231bo33b2o4bo4bo223b' ],
    [ '27bo13bo190bo32b2o5bo227b' ],
    [ '25b2ob2o10bobo229bo3bo7b2o214b' ],
    [ '40bobo231bobo7bobo213b' ],
    [ '24bo5bo10bo244bo213b' ],
    [ '40b2o244b2o212b' ],
    [ '24b2obob2o9b2o230b2o226b' ],
    [ '40b2o230bo227b' ],
    [ '233b3o28bo5bobo227b' ],
    [ '232bo3bo26bobo4b2o228b' ],
    [ '231bo5bo24bo3b2o232b' ],
    [ '231b2obob2o24bo3b2o232b' ],
    [ '262bo3b2o232b' ],
    [ '253b2o8bobo234b' ],
    [ '252bobo9bo235b' ],
    [ '27b2o21b2o200bo247b' ],
    [ '27b2o22bo199b2o247b' ],
    [ '51bobo8b2o167b2o267b' ],
    [ '52b2o7bobo168bo267b' ],
    [ '60bo6b2o160b3o268b' ],
    [ '60bo2bo2bo2bob2o156bo270b' ],
    [ '60bo6b2o2b2o427b' ],
    [ '61bobo436b' ],
    [ '62b2o259bo176b' ],
    [ '318bo4b4o173b' ],
    [ '318bo5b4o172b' ],
    [ '276bo36b2o9bo2bo172b' ],
    [ '271bo4b4o33b2o9b4o172b' ],
    [ '271bo5b4o42b4o5b2o166b' ],
    [ '266b2o9bo2bo42bo8bobo165b' ],
    [ '266b2o9b4o53bo49b2o114b' ],
    [ '276b4o5b2o47b2o48b2o114b' ],
    [ '276bo8bobo212b' ],
    [ '287bo212b' ],
    [ '287b2o98bo112b' ],
    [ '386bo113b' ],
    [ '386bo113b' ],
    [ '500b' ],
    [ '500b' ],
    [ '79b2o301b2o3b2o111b' ],
    [ '79b3o303bo114b' ],
    [ '81b2obo5b2o290bo5bo111b' ],
    [ '81bo2bo5b2o291b2ob2o112b' ],
    [ '81b2obo299bobo113b' ],
    [ '71b2o6b3o303bo8bo105b' ],
    [ '70bobo6b2o304bo6bobo105b' ],
    [ '70bo320bobo11b2o93b' ],
    [ '69b2o319bo2bo11b2o93b' ],
    [ '107bo283bobo106b' ],
    [ '107b3o282bobo105b' ],
    [ '110bo283bo16bo88b' ],
    [ '109b2o273bo24b3o88b' ],
    [ '383bobo22bo91b' ],
    [ '112bo271b2o22b2o90b' ],
    [ '111bobo386b' ],
    [ '110bo3bo290b3o92b' ],
    [ '111b3o291b3o92b' ],
    [ '109b2o3b2o288bo3bo91b' ],
    [ '403bo5bo2b2o86b' ],
    [ '79b2o294b2o27bo3bo3b2o86b' ],
    [ '79b2o294b2o28b3o92b' ],
    [ '378b2o120b' ],
    [ '66b2o31b2o277b3o5b2o112b' ],
    [ '66b2o14bo14bo3bo276b2o6b2o112b' ],
    [ '81bo9b2o3bo5bo265b2o5b2o123b' ],
    [ '81bo9b2o2b2obo3bo264bobo5b2o35b3o85b' ],
    [ '96bo5bo264bo14b2o27b2ob2o84b' ],
    [ '97bo3bo264b2o12bo3bo11bo14b2ob2o84b' ],
    [ '77b2o3b2o2bo12b2o273b2o3bo5bo9bobo13b5o84b' ],
    [ '80bo5b3o285b2o2b2obo3bo10b2o12b2o3b2o83b' ],
    [ '77bo5bo5bo23b2o264bo5bo20b2o92b' ],
    [ '78b2ob2o5b2o23b2o265bo3bo21b2o92b' ],
    [ '65b3o11bobo300b2o42bo73b' ],
    [ '64bo3bo11bo344bobo72b' ],
    [ '63bo5bo10bo344b2obo4b2o65b' ],
    [ '63bo5bo355b2ob2o3b2o65b' ],
    [ '66bo358b2obo71b' ],
    [ '64bo3bo21b3o27bobo267b3o32bobo72b' ],
    [ '65b3o21bo3bo26bo3bo264bo3bo32bo73b' ],
    [ '66bo21bo5bo29bo287bo87b' ],
    [ '76bobo9b2obob2o15b2o8bo4bo262bo5bo16bobo86b' ],
    [ '76b2o32b2o12bo263b2o3b2o17b2o86b' ],
    [ '63b3o11bo3b3o36bo3bo3b2o370b' ],
    [ '63b3o14bo3bo6bo28bobo5bobo369b' ],
    [ '62bo3bo12bo5bo4bobo18b2o17bo260bo26b2o80b' ],
    [ '70bobo6b2obob2o4bobo9b2o7bo2bo15b2o258bobo25bobo79b' ],
    [ '61b2o3b2o3b2o18bo9b3o11bo6b2o266bobo25bo81b' ],
    [ '71bo30bob2o9bo6b2o268bo12b2o5bo87b' ],
    [ '90b2o23bo276bo11b3o3bo3bo85b' ],
    [ '90b2o13bo5bo2bo274bo2bo8bob2o5bo89b' ],
    [ '111b2o182bo94b2o9bo2bo4bo5bo84b' ],
    [ '84b2o18bo188b3o105bob2o9b2o84b' ],
    [ '84bo20bo186bo103b2o6b3o11bo81b' ],
    [ '85b3o17bo186b2o101bobo7b2o11b3o79b' ],
    [ '66b2o19bo307bo25bo78b' ],
    [ '66bo327b2o24b2o78b' ],
    [ '67b3o430b' ],
    [ '69bo33b2o3b2o179b3o208b' ],
    [ '104b5o179b2ob2o207b' ],
    [ '104b2ob2o179b2ob2o16bo190b' ],
    [ '73bo2b2o15bobo8b2ob2o179b5o14b3o190b' ],
    [ '72bo3b2o2b2o11bo2bo8b3o179b2o3b2o12bo114b2o77b' ],
    [ '72bo7b2o14b2o208b2o109b2o2b2o77b' ],
    [ '73b4o17bo3b2o187b2o15b3o110b2o81b' ],
    [ '96b2o190b2o13bobo194b' ],
    [ '85b2o6bo2bo5b2o4b2o175b2ob2o12bo3bo193b' ],
    [ '84bobo6bobo6bobo3bo193b5o145b2o46b' ],
    [ '84bo19bo4b3o180b2o7b2o3b2o112b2o18b3o2bo5bo3bo44b' ],
    [ '83b2o19b2o5bo173bo8bo7b5o114b2o13bo3bo9bo5bo3b2o38b' ],
    [ '287b2obobo10b3o104bo9bo13bobo4bo8bo3bob2o2b2o38b' ],
    [ '304bo105bobo19b2o16bo5bo43b' ],
    [ '398b2o11bobo9b2o7b2o17bo3bo44b' ],
    [ '299b2o97b2o11bo2bo7b3o7b2o18b2o46b' ],
    [ '299bobo109bobo5bob2o5b2o4bobo63b' ],
    [ '299bo110bobo6bo2bo4bo2bo5bo63b' ],
    [ '287b3o120bo8bob2o5b2o70b' ],
    [ '208bo77bo3bo131b3o75b' ],
    [ '203bo4b4o73bo5bo131b2o75b' ],
    [ '203bo5b4o73bo3bo209b' ],
    [ '198b2o9bo2bo74b3o210b' ],
    [ '198b2o9b4o74b3o210b' ],
    [ '208b4o5b2o82b3o196b' ],
    [ '208bo8bobo70b2o8bo3bo195b' ],
    [ '219bo70bo209b' ],
    [ '219b2o70b3o5bo5bo194b' ],
    [ '293bo5b2o3b2o194b' ],
    [ '500b' ],
    [ '500b' ],
    [ '302bo197b' ],
    [ '301bobo196b' ],
    [ '301bobo196b' ],
    [ '303bo196b' ],
    [ '303bo196b' ],
    [ '300bo2bo196b' ],
    [ '301b2o197b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '500b' ],
    [ '2bo493bo3b' ],
    [ 'bobo491bobo2b' ],
    [ 'obo493bobob' ],
    [ '2o495b2ob' ],
    [ '500b' ],
]
helpstring = '''
Game of Life pattern-to-Unit Cell converter
Based on the first original unit cell from David Bell

Script by: NASZVADI P. 2016, some rights reserved.
Free for non-commercial use, if is allowed by the laws
of the script's author's country. Use at your own risk!

Usage:

unitcell.py [-i <inputfile>] [-o <outputfile>] [-b <borderwidth>] [-t]

    -h               this help text
    -i|--infile=     inputfile (format is guessed, maybe buggy, def: STDIN)
    -o|--outfile=    outputfile (rle, def: STDOUT)
    -b <integer>     border width, 1 by default
    -t               make the unit cell space thoroidal

'''
toroidal = 0 # 0, 1 ( = off/on )
border = 1 # natural integer
inputrle = "" # string ~ /(\d*[\$bo.O]\n?)+!/

inputfile = '/dev/stdin'
outputfile = '/dev/stdout'

try:
    opts, args = getopt.getopt(sys.argv[1:],"hi:o:b:t",["infile=","outfile="])
except getopt.GetoptError:
    print helpstring
    sys.exit(1)
for opt, arg in opts:
    if opt == '-h':
        print helpstring
        sys.exit()
    elif opt in ("-i", "--infile"):
        inputfile = arg
    elif opt in ("-o", "--outfile"):
        outputfile = arg
    elif opt in ("-b"):
        border = int(arg)
    elif opt in ("-t"):
        toroidal = 1

try:
    with open(inputfile, 'r') as inpu:
        for line in inpu:
            if line[0] not in ["#", "x", "!" ]:
                inputrle += line
except:
    print "ERROR: Cannot read '%s'" % inputfile
    sys.exit(1)

if "b" in inputrle or "o" in inputrle:
    # rle      o  /  b
    inputrletmp = ""
    inputrle = inputrle.replace("\r","")
    inputrle = inputrle.replace("\n","")
    inputrle = inputrle.replace("!","")
    regexp = re.compile(r'(\d*)([\$bo])')
    for m in re.finditer(regexp, inputrle):
        try:
            countre = 1 * int(m.group(1))
        except:
            countre = 1
        if m.group(2) == "$":
            inputrletmp += str(countre * "\n")
        elif m.group(2) == "o":
            inputrletmp += str(countre * "O")
        else:
            inputrletmp += str(countre * ".")
    inputrle = inputrletmp

patternlist = inputrle.split("\n")
listmax = 0
for i in patternlist:
    if len(i) > listmax: listmax = len(i)
for i in range(len(patternlist)):
    patternlist[i] += (border + listmax - len(patternlist[i])) * "."
    patternlist[i] = border * "." + patternlist[i]
for i in range(border):
    patternlist.insert(0,(listmax + (2 * border)) * ".")
    patternlist.append((listmax + (2 * border)) * ".")

with open(outputfile, 'w') as outpu:
    if toroidal:
        toprint = """#CXRLE Pos=%d,%d
x = %d, y = %d, rule = B3/S23:T%d,%d

""" % (-len(unitcell)*len(patternlist[0])/2,-len(unitcell)*len(patternlist)/2, \
       len(unitcell)*len(patternlist[0])-1,len(unitcell)*len(patternlist)-1, \
       len(unitcell)*len(patternlist[0]),len(unitcell)*len(patternlist))
    else:
        toprint = """#CXRLE Pos=0,0
x = %d, y = %d, rule = B3/S23

""" % (len(unitcell)*len(patternlist[0])-1,len(unitcell)*len(patternlist)-1)
    for rows in patternlist:
        for i in range(len(unitcell)):
            for columns in rows:
                toprint += unitcell[i][-(columns in ["O", "o"])]
            toprint += "$\n"
    toprint += "!"
    outpu.write(toprint)

sys.exit(0)

User avatar
dvgrn
Moderator
Posts: 6036
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Made a Unit Cell grid creator for Game of Life

Post by dvgrn » December 9th, 2016, 4:12 pm

Naszvadi wrote:Created a python garbage, which converts an rle format GoL pattern file to rle format embedding the pattern into a grid of unit cells made by David Bell. Each unit cell has a size of 500x500.
See also metafier.py, and metafier.lua in Golly 2.8, which does the same trick for a selected pattern using Brice Due's metacells (2048x2048, if I remember right, but it's a lot easier to see the ON vs. OFF states).

Naszvadi
Posts: 388
Joined: May 7th, 2016, 8:53 am
Contact:

Re: Made a Unit Cell grid creator for Game of Life

Post by Naszvadi » December 9th, 2016, 7:01 pm

dvgrn wrote:...
See also metafier.py, and metafier.lua in Golly 2.8, which does the same trick for a selected pattern using Brice Due's metacells (2048x2048, if I remember right, but it's a lot easier to see the ON vs. OFF states).
I use metapixel grid generator too, it is pretty useful for demonstrating. And from now a new proof is given for the Turing-completeness for Game of Life. Because B3/S238 can be embedded into Life via OTCA-metapixel, and EightLife is Turing-complete.

And I have just created a bash script (no ksh/zsh/sh/csh...) for creating a Rule-110 automaton on a tape in B3/S23[8] etc. Uses Jason Summers' rotated unit cell. Here you are:

Code: Select all

#!/bin/bash
if [[ ! $1 =~ ^[01]+$ ]]; then
echo 'ERROR:' >&2
echo 'A finite looped cellspace must be specified (for Rule-110)' >&2
echo 'like "'"$0"' 000001"' >&2
exit 1
fi
SPACE="$1"
OUTFILE=aout.rle
cat >"$OUTFILE" <<END
#C Unit cell for Wolfram's "Rule 110".
#C Place multiple copies of this pattern in a horizontal
#C row, overlapping the decorative still-lifes at the corners.
#C The state of the cell is determined by the presence (OFF)
#C or absence (ON) of a glider between the tubs at generation
#C 1200N. Note the negative logic. For generation 0, the
#C state of the cell is forced ON by the block in front of the
#C glider. Delete the block to set the state to OFF.
#C Jason Summers, 19 Dec '05
#C NASZVADI P.: this Unit cell also works in rules
#C between B3/S23 and B3/S234c6e8, so for example:
#C B3/S238 is Turing-complete!
#C Unit cell rotated diagonally
x = $((256*${#SPACE})), y = 263, rule = B3/S238:T0,$((256*${#SPACE}))
END
for((I=0;I<${#SPACE};++I)); do
if ((${SPACE:I:1})); then
STATE=o
else
STATE=b
fi
echo -n '33b2o$34bo$34bobo6b2o$35b3o5bobo$37b3o6bo$37bo2bo2bo2bo7b2o$38b2o6bo7b
2o$43bobo$43b2o12$4b2o$4b2o11$2b2o3b2o$4b3o$3bo3bo$4bobo$5bo$16b3o$6b
3o7bo$6b3o8bo4$4b2o3b2o$5b5o14b2o$6b3o15bobo$7bo16bo6$31b3o62bo$31bo
62bobo$7b2o23bo53bo5b2o12b2o$7b2o76bobo4b2o12b2o$84bo3bo3b2o$84b5o5bob
o$83b2o3b2o6bo$39b2o43b5o$39bobo43b3o$39bo46bo14b2o$102bo$102bobo9bo$
103b2o9bobo$115bobo$115bo2bo3b2o$46b3o66bobo4b2o$46bo67bobo$47bo66bo$
85b2o$85b2o3$54b2o$54bobo$54bo6$61b3o$61bo$62bo4$61bo$61b3o5b2o$64bo4b
obo$63b2o4bo5$66bo8bo$65b3o7b2o$64b5o7b2o2b2o$63bobobobo10b2o$63b2o3b
2o5bobo$75bobo$76bo6b2o$68b2o14bo$68b2o14bobo6bo$70bo14b2o4bobo$55b2o
11b3o18b2o18b2o$55b2o9bo22b2o17bo3bo$66b5o12b2o4b2o16bo5bo3b2o$67b2o
13b2o7bobo4bo8bo3bob2o2b2o$84bo8bo3bo9bo5bo$97b3o2bo5bo3bo19b2o$65b2o
3b2o37b2o21bo$66b5o53bo5bobo$66b2ob2o52bobo4b2o$66b2ob2o20bo31b2obo$
55b3o9b3o20b2o19b2o10b2ob2o$54bo3bo31bobo18b2o10b2obo$53bo5bo45bo17bob
o$53bo5bo38b2'"${STATE}"'4bobo17bo$56bo41b2'"${STATE}"'5bo$54bo3bo34b2o$55b3o9b2o24b2o6b3o$
56bo10b2o32bo$102bo12bo$33b2o64bo13b3o$33b2o22b3o38bobo11bo$57b3o39bo
12b2o11b2o$56bo3bo64b2o$50bobo56b2o$50b2o3b2o3b2o28b2o17bobo49b2o$51bo
38b2o17bo51b2o2$133b2o$133b2o2$44bo$31b5o6b2o72b3o$30bob3obo6b2o71bo7b
3o15b2o$31bo3bo81bo5bo3bo15bo$32b3o23b2o31bo30bo5bo4b3o4b3o15b2obob2o$
33bo24b2o30b3o30bo3bo12bo$89b5o30b3o6bobo10b2o10bo5bo$88b2o3b2o28bo2bo
5b5o9b2o$89b5o29b3o5b2o3b2o21b2ob2o$31bo10b2o45b5o28bob2o5b2o3b2o23bo$
31bo11bo46bo2bo28bobo$30bobo10bobo7bo36bo3bo28bo$29b2ob2o2bobo5b2o4b4o
40bo7b2o29b2o$28bo5bo2bo11b4o38b2obo6b2o29b2ob2o8b3o15b2o$31bo17bo2bo
40bo9bo16b2o3b2o6bo2bo7b2ob2o14bo$28b2o3b2o14b4o67bobobobo6bo10b2ob2o
15b3o$50b4o7b2o58b5o10bo7b5o17bo$53bo7bobo26b2o3b2o25b3o9b2o7b2o3b2o$
32bo30bo26bo5bo26bo$32bo30b2o45bo$33bo57bo3bo13b2o18b2o3b2o$92b3o14bob
o18b5o5bo5bo$131b3o7b2o2bobo77b2o$30b2o100bo7b2o3bobo77b2o$30b2o114bo$
122b2o$122b2o101bo$117b2o105b3o$93b2o21b2o25bo79bo3bo$93b2o23bo10b2o
10b2ob2o79bo$130bo91bo5bo$127b3o10bo5bo75bo5bo$127bo95bo3bo$140b2obob
2o77b3o$125bo$124b2o$124bobo2$223bo3$223bo$132b2o9b2o78bobo$131b2o10b
2o78b2o$133bo2$145b2o65b2o$145bo2bo63b2o10b2o3b2o$135bo3b3o7bo6b2o58bo
$134b5o3bo6bo6b2o57bo9bo3bo$133b2ob2o3bo7bo65b3o8b3o$122b2o8b3ob2o3bo
3bo2bo77b3o$122b2o9b2ob4o5b2o$134b4o$135bo93b2o$229bo$146b2o60bo21b3o$
146b2o60bobo21bo$208b2o27bo$235b3o$234bo$234b2o2$147bo53bo$146b3o51bo$
146b3o51b3o2$144b2o3b2o80b3o$144b2o3b2o79bo3bo$156bo56b2o$156b2o55bo
15bo5bo$147bo3b2o4b2o43b2o7bobo15b2o3b2o$146bobo2b2o4b3o7b2o33bobo6b2o
$146bobo2b2o4b2o8b2o23bo4b2o6bo$147bo8b2o33bobo2bo2bo2bo2bo26bo$156bo
34b2obob3o6bo25bobo$179b2o10b2ob2o6bobo26bobo$179b2o10b2obo7b2o29bo$
191bobo39bo$192bo37bo2bo$231b2o3$68bo2bob2obo2bo$68b4ob2ob4o119bobo$
68bo2bob2obo2bo119bo2bo$92bo4bo92b2o10b2o$90b2ob4ob2o90b2o8bo3b2o$92bo
4bo97b2o5b2o$194bo4bo2bo$199bobo5$128b2o76bo$128bobo74b3o$123b2o6bo7b
2o63b5o$122bo2bo2bo2bo7b2o62bobobobo$122b3o6bo71b2o3b2o$120b3o5bobo$
119bobo6b2o$119bo86bo$118b2o85bobo$205bobo$206bo$206b2o$206b2o$206b2o
11$o$' >>"$OUTFILE"
done
echo '!'>>"$OUTFILE"
exit 0
Usage is self-explanatory, trivial, whatever. It creates an "aout.rle" rle file with a metapixel chain from the script's first argument, which must be a nonempty "0-1" string.

And what I created with it, is here: http://conwaylife.com/forums/viewtopic.php?f=11&t=2597

Post Reply