-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rules.java
30 lines (30 loc) · 1.35 KB
/
Rules.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* An interface that repersents the rules used in the game.
* You must register your rules class in static final LifeGame.rulesList
* @author Gavin Yancey
*/
public interface Rules
{
/**@return the default cell state*/
int getDefaultCellState();
/**@return an array of all the acceptable cell states*/
int[] getAcceptableCellStates();
/**@return the color of a cell based on it's cell state*/
java.awt.Color getCellColor(int cellState);
/**@return the amount any cell counts for in a neighbor count*/
int getNeighborValue(int cellState);
/**used when stepping
* @return the next cell state, based on the curent cell state and the neighbor count*/
int getCellState(int cellState, int neighborCount);
/**used for changing rules, cell might not be an acceptable cell state, make sure it is one*/
int getCellState(int cellState);
/**used for reading the game from a file
* @return the cell state represented by any charactor in a life file*/
int getCellStateFromFile(char c);
/**used for saving the game in a file
* @return the charactor that would represent the cell state in a life file*/
char getCellStateForFile(int cellState);
/**used for changing the cell state when a cell is clicked on
* @return the new cell state from a clicked cell*/
int getCellStateFromClick(int cellState);
}