mw-engine.world
Functions to create and to print two dimensional cellular automata.
Nothing in this namespace should determine what states are possible within the automaton, except for the initial state, :new.
A cell is a map containing at least values for the keys :x
, :y
, and :state
.
A world is a two dimensional matrix (sequence of sequences) of cells, such that every cell’s :x
and :y
properties reflect its place in the matrix.
format-cell
(format-cell cell)
Return a formatted string summarising the current state of this cell.
make-cell
macro
(make-cell x y)
Create a minimal default cell at x, y
x
the x coordinate at which this cell is created;y
the y coordinate at which this cell is created.
make-world
(make-world width height)
Make a world width cells from east to west, and height cells from north to south.
width
a natural number representing the width of the matrix to be created;height
a natural number representing the height of the matrix to be created.
print-world
(print-world world)
Print the current state of this world, and return nil.
world
a world as defined above.
truncate-state
(truncate-state cell limit)
Truncate the print name of the state of this cell to at most limit characters.