Package ball.game.life
Class Automata
- java.lang.Object
-
- ball.game.life.Automata
-
public class Automata extends Object
LifeAutomata.- Author:
- Allen D. Ball
-
-
Constructor Summary
Constructors Constructor Description Automata(int height, int width)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanget(BigInteger state, int y, int x)Method to get the value of a cell at a specified(y, x)coordinate fron the argumentstate.intgetHeight()Method to get the height of the board.intgetWidth()Method to get the width of the board.BigIntegernext(BigInteger current)Given the currentstate, calculate the nextstate.
-
-
-
Constructor Detail
-
Automata
@ConstructorProperties({"height","width"}) public Automata(int height, int width)
- Parameters:
height- The extent of the y-axis.width- The extent of the x-axis.
-
-
Method Detail
-
getHeight
public int getHeight()
Method to get the height of the board.- Returns:
- The height.
-
getWidth
public int getWidth()
Method to get the width of the board.- Returns:
- The width.
-
next
public BigInteger next(BigInteger current)
Given the currentstate, calculate the nextstate.- Parameters:
current- The currentstate.- Returns:
- The next
state.
-
get
public boolean get(BigInteger state, int y, int x)
Method to get the value of a cell at a specified(y, x)coordinate fron the argumentstate.- Parameters:
state- TheAutomatastate.y- Theycoordinate.x- Thexcoordinate.- Returns:
trueif the(y, x)coordinate is valid and if the specified cell is "alive;"falseotherwise.
-
-