You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,13 @@ Below is an example of the GameOfLife rules json file:
12
12
{
13
13
"deathValues" : [1, 4],
14
14
"survivialValues": [2, 3],
15
-
"populationValues": [3]
15
+
"populationValues": [3],
16
+
"neighborPadding" : 1
16
17
}
17
18
```
18
19
Cells will die when they have less than or equal to ```deathValues[0]``` neighbors, and more than or equal to ```deathValues[1]```.
19
20
Cells will survive for the next iteration if the amount of neighbors they have equals any of the survivialValues. An empty cell will become populated if the amount of neighbors it has equals any of the population values.\
20
-
Note that neighbors is equal to the 8 surrounding cells.
21
+
To update the amount of cels in each direction you want to check for neighbors, update ```neighborPadding```. In the case of Conway's Game of Life, a padding of 1 checks the 8 surrounding cells.
21
22
22
23
### Applying a Custom Rule Set
23
24
In the ``Rules`` class, change the line ```InputStream ruleFile = GraphicsManager.class.getResourceAsStream("/rules/GameOfLife_rules.json");``` to load the json file you just wrote: ```InputStream ruleFile = GraphicsManager.class.getResourceAsStream("/rules/MY_NEW_RULES.json");```
0 commit comments