All Projects → ljvmiranda921 → Seagull

ljvmiranda921 / Seagull

Licence: mit
A Python Library for Conway's Game of Life

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Seagull

Funmath
☔️ Implementations of mathematical functions, formulas and concepts
Stars: ✭ 93 (-28.46%)
Mutual labels:  mathematics
Indra
INDRA (Integrated Network and Dynamical Reasoning Assembler) is an automated model assembly system interfacing with NLP systems and databases to collect knowledge, and through a process of assembly, produce causal graphs and dynamical models.
Stars: ✭ 105 (-19.23%)
Mutual labels:  biology
Domains
A computational algebra system in Smalltalk.
Stars: ✭ 124 (-4.62%)
Mutual labels:  mathematics
D3graphtheory
💥 Interactive and colorful 🎨 graph theory tutorials made using d3.js ⚡️
Stars: ✭ 1,364 (+949.23%)
Mutual labels:  mathematics
Root
The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
Stars: ✭ 1,377 (+959.23%)
Mutual labels:  mathematics
Studybook
Study E-Book(ComputerVision DeepLearning MachineLearning Math NLP Python ReinforcementLearning)
Stars: ✭ 1,457 (+1020.77%)
Mutual labels:  mathematics
Octsympy
A Symbolic Package for Octave using SymPy
Stars: ✭ 92 (-29.23%)
Mutual labels:  mathematics
Graphonline
This is source code of graphonline service. Graphonline helps visualize graph and applies a lot of algorithms.
Stars: ✭ 127 (-2.31%)
Mutual labels:  mathematics
Math Expression Evaluator
Math JS library. Super advanced & efficient Math expression evaluator
Stars: ✭ 102 (-21.54%)
Mutual labels:  mathematics
Python Mathematics Handbook
A set of notebooks for an introduction to Python for Mathematicians.
Stars: ✭ 117 (-10%)
Mutual labels:  mathematics
Algorithms
A collection of algorithms and data structures
Stars: ✭ 11,553 (+8786.92%)
Mutual labels:  mathematics
Project Euler Solutions
Runnable code for solving Project Euler problems in Java, Python, Mathematica, Haskell.
Stars: ✭ 1,374 (+956.92%)
Mutual labels:  mathematics
Cadabra2
A field-theory motivated approach to computer algebra.
Stars: ✭ 112 (-13.85%)
Mutual labels:  mathematics
Researchpapernotes
Initiative to read research papers
Stars: ✭ 97 (-25.38%)
Mutual labels:  mathematics
Echo
Python package containing all custom layers used in Neural Networks (Compatible with PyTorch, TensorFlow and MegEngine)
Stars: ✭ 126 (-3.08%)
Mutual labels:  mathematics
Computer Science Resources
A list of resources in different fields of Computer Science (multiple languages)
Stars: ✭ 1,316 (+912.31%)
Mutual labels:  mathematics
Sage
Mirror of the Sage source tree -- please do not submit PRs here -- everything must be submitted via https://trac.sagemath.org/
Stars: ✭ 1,656 (+1173.85%)
Mutual labels:  mathematics
Gonum
开源Go语言数值算法库(An open numerical library purely based on Go programming language)
Stars: ✭ 128 (-1.54%)
Mutual labels:  mathematics
Calc
C-style arbitrary precision calculator
Stars: ✭ 127 (-2.31%)
Mutual labels:  mathematics
Dmsh
Simple mesh generator inspired by distmesh.
Stars: ✭ 113 (-13.08%)
Mutual labels:  mathematics

A Python library for Conway's Game of Life

This framework allows you to create and simulate various artificial lifeforms and cellular automata easily: simply define your board, add your lifeforms, and execute the run command! 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:

import seagull as sg
from seagull.lifeforms import Pulsar

# Initialize board
board = sg.Board(size=(19,60))  

# Add three Pulsar lifeforms in various locations
board.add(Pulsar(), loc=(1,1))
board.add(Pulsar(), loc=(1,22))
board.add(Pulsar(), loc=(1,42))

# Simulate board
sim = sg.Simulator(board)      
sim.run(sg.rules.conway_classic, iters=1000)

Optionally, you can animate the simulation by running sim.animate():

Aside from Pulsar, we have a nice collection of lifeforms for you to choose from!

Installation

To install Seagull, run this command in your terminal:

pip install pyseagull

This 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:

git clone https://github.com/ljvmiranda921/seagull.git

and then run

cd seagull
python setup.py install

Usage

There are three main components for an artificial life simulation:

  • The Board or the environment in which the lifeforms will move around
  • The Lifeform that will interact with the environment, and
  • The rules that dictate if a particular cell will survive or not

In Seagull, you simply define your Board, add your Lifeform/s, and run the Simulator given a rule. You can add multiple lifeforms as you want:

import seagull as sg
from seagull import lifeforms as lf

board = 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 board

Then 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 history
sim.animate()

Adding custom lifeforms

You can manually create your lifeforms by using the Custom class:

import seagull as sg
from seagull.lifeforms import Custom

board = sg.Board(size=(30,30))
board.add(Custom([[0,1,1,0], [0,0,1,1]]), loc=(0,0))

Obtaining simulation statistics and history

By default, the simulation statistics will always be returned after calling the run() method. In addition, you can also obtain the history by calling the get_history() method.

# The run() command returns the run statistics
stats = sim.run(sg.rules.conway_classic, iters=1000)
# You can also get it using get_history()
hist = sim.get_history()

Examples

You can find more examples in the documentation

Contributing

This 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 a Pull Request.

Simply fork this repository and make a Pull Request! We'd definitely appreciate:

  • Implementation of new features
  • Bug Reports
  • Documentation
  • Testing

License

MIT License (c) 2019, Lester James V. Miranda

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].