Update README
This commit is contained in:
parent
79497607e3
commit
cf68ca978d
118
README.md
118
README.md
|
|
@ -2,20 +2,20 @@
|
||||||
# Game Of Life
|
# Game Of Life
|
||||||
The Game of Life (an example of a cellular automaton) is played on an infinite two-dimensional rectangular grid of cells. Each cell can be either alive or dead. The status of each cell changes each turn of the game (also called a generation) depending on the statuses of that cell's 8 neighbors. Neighbors of a cell are cells that touch that cell, either horizontal, vertical, or diagonal from that cell.
|
The Game of Life (an example of a cellular automaton) is played on an infinite two-dimensional rectangular grid of cells. Each cell can be either alive or dead. The status of each cell changes each turn of the game (also called a generation) depending on the statuses of that cell's 8 neighbors. Neighbors of a cell are cells that touch that cell, either horizontal, vertical, or diagonal from that cell.
|
||||||
|
|
||||||
### Reminder of basic game of life rules by
|
### Reminder of basic game of life rules
|
||||||
1. Any living cell with strictly fewer than two living neighbors dies (referred to
|
1. Any living cell with strictly fewer than two living neighbors dies (referred to
|
||||||
as underpopulation or exposure).
|
as underpopulation or exposure).
|
||||||
|
|
||||||
2. Any living cell with strictly more than three living neighbors dies (referred to
|
2. Any living cell with strictly more than three living neighbors dies (referred to
|
||||||
as overpopulation or overcrowding).
|
as overpopulation or overcrowding).
|
||||||
|
|
||||||
3. Any dead cell with exactly three living neighbors will come to life. (Referred to as
|
3. Any dead cell with exactly three living neighbors will come to life. (Referred to as
|
||||||
spreading or growth)
|
spreading or growth)
|
||||||
With the implied additional rules:
|
With the implied additional rules:
|
||||||
|
|
||||||
4. Any living cell with two or three living neighbors continues to live, unchanged.
|
4. Any living cell with two or three living neighbors continues to live, unchanged.
|
||||||
|
|
||||||
5. Any dead cell who doesn’t have exactly 3 living neighbors stays dead, unchanged.
|
5. Any dead cell who doesn’t have exactly 3 living neighbors stays dead, unchanged.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,80 +48,96 @@ Go to the project directory
|
||||||
cd OOP_F1_Project
|
cd OOP_F1_Project
|
||||||
```
|
```
|
||||||
|
|
||||||
Install dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
TODO How to install the json-simple-1.1.1.jar
|
|
||||||
```
|
|
||||||
|
|
||||||
Start the program
|
Start the program
|
||||||
|
|
||||||
|
a. Compile the Java source files :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
TODO ???? => javac .\src\Main.java
|
javac -cp lib/json-simple-1.1.1.jar src/Main.java
|
||||||
```
|
```
|
||||||
|
|
||||||
|
b. Run the compiled Java program, including the jar file in the classpath:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -cp .:lib/json-simple-1.1.1.jar src/Main
|
||||||
|
```
|
||||||
## Basic How to
|
## Basic How to
|
||||||
|
|
||||||
- Load Rules
|
- Load Rules
|
||||||
By default, Coneways rules are loaded. You can load other set of rules by clicking the "Load Rule" button.
|
By default, Coneways rules are loaded. You can load other set of rules by clicking the "Load Rule" button.
|
||||||
|
|
||||||
- Create Field
|
- Create Field
|
||||||
Create the fild either by generating a random field, or by clicking yourself on cells (Don't forget to Toggle click).
|
Create the fild either by generating a random field, or by clicking yourself on cells.
|
||||||
|
|
||||||
- Toggle Border
|
- Toggle Border
|
||||||
There is 2 different iterations methodes.
|
There is 2 different iterations methodes.
|
||||||
|
|
||||||
1. Closed
|
1. Closed
|
||||||
The sides of the gride will count as dead.
|
The sides of the gride will count as dead.
|
||||||
|
|
||||||
2. Loop
|
2. Loop
|
||||||
The gride technicaly has no sides. The left handside is connected to the right one, the top to the bottom.
|
The gride technicaly has no sides. The left handside is connected to the right one, the top to the bottom.
|
||||||
All 4 corners cells are nearby cells of each others.
|
All 4 corners cells are nearby cells of each others.
|
||||||
|
|
||||||
-
|
|
||||||
|
|
||||||
### Rule Sets
|
|
||||||
|
|
||||||
1. Basic John Conway's Rule
|
|
||||||
The basic rule set described above
|
|
||||||
|
|
||||||
world advised: conwaySingleShotCannon.csv backRake.csv glider.csv gliderTrain.csv gosperGlidergun.csv r_pento.csv
|
|
||||||
|
|
||||||
2. Blob Rule
|
|
||||||
A modification of john conway's game of life with much more birth and survive value, very good to play around with sheeps if you want them to starve a bit but not too much
|
|
||||||
|
|
||||||
3. Grass for sheeps Rule
|
|
||||||
give many grass for sheeps to eat from, very good to play with hunting wolves
|
|
||||||
|
|
||||||
4. Hash Life Rule
|
|
||||||
game of life with more birthing values
|
|
||||||
|
|
||||||
5. Gas Rule
|
|
||||||
Uses a Highest neighbour instead of a count near. gas excite (explode) when one of his neighbour is excited, and takes 5 turns to return to an excitable state.
|
|
||||||
Inspired by this video from Steve Mould "[Bizarre travelling flame discovery](https://youtu.be/SqhXQUzVMlQ?t=418)"
|
|
||||||
|
|
||||||
world advised: randomFive.csv interestingGas.csv densityStyle.csv
|
|
||||||
|
|
||||||
|
- Add agents
|
||||||
|
By clicking on toggle click, or by importing an agent file, you are able to place on the grid specific agents like a sheep or a wolf.
|
||||||
|
|
||||||
## Color Reference
|
## Color Reference
|
||||||
|
|
||||||
|
### Coneway Rule
|
||||||
|
|
||||||
| Color | HEX | RGB |
|
| Color | HEX | RGB |
|
||||||
| ----------------- | ------------------------------------------------------------------ |------|
|
| ----------------- | ------------------------------------------------------------------ |------|
|
||||||
| Dead |  #25341F | [37,52,31] |
|
| Dead |  #25341F | [37,52,31] |
|
||||||
| Alived |  #f8f8f8 | [167,237,139] |
|
| Alived |  #f8f8f8 | [167,237,139] |
|
||||||
|
|
||||||
|
### Blob Rule
|
||||||
|
|
||||||
|
| Color | HEX | RGB |
|
||||||
|
| ----------------- | ------------------------------------------------------------------ |------|
|
||||||
|
| Dead |  #615e3a | [97,94,58] |
|
||||||
|
| Alived |  #dcff42 | [255,255,66] |
|
||||||
|
|
||||||
|
### Gaz Rule
|
||||||
|
|
||||||
|
| Color | HEX | RGB |
|
||||||
|
| ----------------- | ------------------------------------------------------------------ |------|
|
||||||
|
| Dead |  #000000 | [0,0,0] |
|
||||||
|
| Excited state 1 |  #333333 | [51,51,51] |
|
||||||
|
| Excited state 2 |  #666666 | [102,102,102] |
|
||||||
|
| Excited state 3 |  #999999 | [153,153,153] |
|
||||||
|
| Excited state 4 |  #cccccc | [204,204,204] |
|
||||||
|
| Excited state 5 |  #ffffff | [255,255,255] |
|
||||||
|
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
#### Question 1
|
#### How to make my own rules ?
|
||||||
|
|
||||||
Answer 1
|
To create a rule, you have to know how many cell states you will have. For each cell state, you have to add a cell onject in the json file, like the following one :
|
||||||
|
|
||||||
#### Question 2
|
```json
|
||||||
|
{"cell": {
|
||||||
|
"value" : 0,
|
||||||
|
"color" : [97, 94, 58],
|
||||||
|
"conditionCountNear" : [1,3,5,8],
|
||||||
|
"conditionHighestNear" : [],
|
||||||
|
"ifValue" : 1,
|
||||||
|
"elseValue" : 0
|
||||||
|
}}
|
||||||
|
```
|
||||||
|
- value: The state value of the cell.
|
||||||
|
- color: An array representing the RGB color of the cell.
|
||||||
|
- conditionCountNear: An array specifying the counts of neighboring cells that satisfy the condition for this state to change.
|
||||||
|
- conditionHighestNear: An array specifying conditions based on the highest value of neighboring cells.
|
||||||
|
- ifValue: The state the cell changes to if conditions are met.
|
||||||
|
- elseValue: The state the cell changes to if conditions are not met.
|
||||||
|
|
||||||
Answer 2
|
#### What are agents ?
|
||||||
|
|
||||||
|
Agents are specific objects on top of the grid with a specific behaviour. In this project, 2 agents are implemented :
|
||||||
|
- Sheep : Sheeps have a hunger, and have to eat grass (Living cells) for them to survive. They can reproduce and act dummy, by moving in a random way.
|
||||||
|
- Wolf : Wolfs also have a hunger, but they have to eat a ship to survive. They can reproduce, and act as dummy if no sheeps are in their radar. If a ship is in its detection radius, the wolf focus the ship and walk towards him.
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,4 @@
|
||||||
"conditionHighestNear" : [],
|
"conditionHighestNear" : [],
|
||||||
"ifValue" : 1,
|
"ifValue" : 1,
|
||||||
"elseValue" : 0
|
"elseValue" : 0
|
||||||
}}
|
}}]
|
||||||
]
|
|
||||||
Loading…
Reference in New Issue