Interface CellularAutomaton<S>
- All Known Implementing Classes:
ConwayLife
public interface CellularAutomaton<S>
Interface for Cellular Automata.
A cellular automaton is a discrete model studied in computability theory, mathematics, physics, and theoretical biology. It consists of a grid of cells, each in one of a finite number of states, evolving through discrete time steps according to local rules.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptiondefault longReturns the current generation number.intGets the height of the grid.getState(int x, int y) Gets the state of the cell at the specified coordinates.intgetWidth()Gets the width of the grid.voidAdvances the automaton by one generation.default voidreset()Resets the automaton to initial state.voidSets the state of the cell at the specified coordinates.
-
Method Details
-
nextGeneration
void nextGeneration()Advances the automaton by one generation. -
getState
Gets the state of the cell at the specified coordinates.- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the state at (x, y)
-
setState
Sets the state of the cell at the specified coordinates.- Parameters:
x- the x coordinatey- the y coordinatestate- the new state
-
getWidth
int getWidth()Gets the width of the grid.- Returns:
- grid width
-
getHeight
int getHeight()Gets the height of the grid.- Returns:
- grid height
-
getGeneration
default long getGeneration()Returns the current generation number.- Returns:
- generation count
-
reset
default void reset()Resets the automaton to initial state.
-