The Board represents the environment where lifeforms can evolve, you can initialize a Board by passing a tuple representing its size:

import seagull as sg
board = sg.Board(size=(30, 30))  # default is (100, 100)

You can add lifeforms to the board by using the add() command. You should pass an instance of the lifeform and its location on the board. The loc parameter is anchored at the top-left for two-dimensional lifeforms and to the left for one-dimensional lifeforms. It follows numpy’s indexing convention

Whenever a lifeform’s size exceeds the edge of the board, then Seagull throws a ValueError:

import seagull as sg
board = sg.Board()
board.add(sg.lifeforms.Blinker(length=3), loc=(0,0))

You can always view the board’s state by calling the view() method. Lastly, you can clear the board with the clear() command.

class seagull.board.Board(size=(100, 100))[source]

Represents the environment where the lifeforms can grow and evolve

__init__(size=(100, 100))[source]

Initialize the class


size (array_like of size 2) – Size of the board (default is (100, 100))

add(lifeform, loc)[source]

Add a lifeform to the board

  • lifeform (seagull.lifeforms.base.Lifeform) – A lifeform that can evolve in the board

  • loc (array_like of size 2) – Initial location of the lifeform on the board


Clear the board and remove all lifeforms

view(figsize=(5, 5))[source]

View the current state of the board


figsize (tuple) – Size of the output figure


Graphical view of the board

Return type

(matplotlib.figure.Figure, matplotlib.image.AxesImage)