Package: pyseagull
A Python library for Conway's Game of LifeThis framework allows you to create and simulate various artificial lifeforms
and cellular automata easily: simply define your board, add your lifeforms,
and execute theruncommand! It also provides a myriad of pre-made
lifeforms while allowing you to create your own.Why name it Seagull?Conway's Game of Life is quite a mouthful, so I just refer to
its acronym, CGoL. The word "seagull" is just a pun of that.Simulate your first lifeforms in few lines of code:importseagullassgfromseagull.lifeformsimportPulsar# Initialize boardboard=sg.Board(size=(19,60))# Add three Pulsar lifeforms in various locationsboard.add(Pulsar(),loc=(1,1))board.add(Pulsar(),loc=(1,22))board.add(Pulsar(),loc=(1,42))# Simulate boardsim=sg.Simulator(board)sim.run(sg.rules.conway_classic,iters=1000)Optionally, you can animate the simulation by runningsim.animate():Aside fromPulsar, we have anice collection of
lifeformsfor you to choose from!InstallationTo install Seagull, run this command in your terminal:pipinstallpyseagullThis is the preferred method to install Seagull, as it will always install
the most recent stable release.In case you want to install the bleeding-edge version, clone this repo:gitclonehttps://github.com/ljvmiranda921/seagull.gitand then runcdseagull
pythonsetup.pyinstallUsageThere are three main components for an artificial life simulation:TheBoardor the environment in which the lifeforms will move aroundTheLifeformthat will interact with the environment, andTherulesthat dictate if a particular cell will survive or notIn Seagull, you simply define yourBoard, add yourLifeform/s, and run theSimulatorgiven arule. You can add multiple lifeforms as you want:importseagullassgfromseagullimportlifeformsaslfboard=sg.Board(size=(30,30))board.add(lf.Blinker(length=3),loc=(4,4))board.add(lf.Glider(),loc=(10,4))board.add(lf.Glider(),loc=(15,4))board.add(lf.Pulsar(),loc=(5,12))board.view()# View the current state of the boardThen you can simply run the simulation, and animate it when needed:sim=sg.Simulator(board)hist=sim.run(sg.rules.conway_classic,iters=1000)# Save simulation historysim.animate()Adding custom lifeformsYou can manually create your lifeforms by using theCustomclass:importseagullassgfromseagull.lifeformsimportCustomboard=sg.Board(size=(30,30))board.add(Custom([[0,1,1,0],[0,0,1,1]]),loc=(0,0))Obtaining simulation statistics and historyBy default, the simulation statistics will always be returned after calling therun()method. In addition, you can also obtain the history by calling theget_history()method.# The run() command returns the run statisticsstats=sim.run(sg.rules.conway_classic,iters=1000)# You can also get it using get_history()hist=sim.get_history()ExamplesYou can find more examples in thedocumentationContributingThis project is open for contributors! Contibutions can come in the form of
feature requests, bug fixes, documentation, tutorials and the like! We highly
recommend to file an Issue first before submitting aPull
Request.Simply fork this repository and make a Pull Request! We'd definitely
appreciate:Implementation of new featuresBug ReportsDocumentationTestingLicenseMIT License (c) 2019, Lester James V. Miranda