This program was used at the 2016 & 2017 Des Moines Global Day of Code Retreat event.
Attendees implemented logic behind a single cell in the language of their choice and utilized the REST API methods of this server to
- Register with the universe, receive their Battleship-style coordinate in return (A5, B7, etc.)
- GET cell state (DEAD / ALIVE / UNKNOWN) of their neighbors for any generation
- POST their cell state (DEAD / ALIVE) for any generation
Universe - Contains generations of cells. Has a width and height.
Generation - Contains cells and their state in this generation.
Cell - Can be dead, alive, or unknown in any generation.
- gradle
- Redis
- Java 1.8+
For ubuntu this means either configuring redis to run at start of the system or run from the command line. See the Redis Quick Start for details. The quicker quick start run from the command line:
sudo apt-get install -y redis-*
redis-server&cd /path/to/cdcr_universe
./gradlew jarThe path to the jar after the build command above will be: /path/to/gdcr_universe/build/libs/.
# java -jar /path/to/jar/universe-1.0.0.jar
http://{your_ip}:8080/universe/@currentUniverse/generation/0
POST http://{your_ip}:8080/universe/
POST Body
{"width":"25","height":"25"}
GET http://{your_ip}:8080/universe/@currentUniverse/register
Response: Battleship-style coordinate
GET http://{your_ip}:8080/universe/@currentUniverse/generation/{generation_index}/cell/{coordinate}
Response:
{
"cellState": "DEAD"
}
POST http://{{your_ip}}:8080/universe/@currentUniverse/generation/{generation_index}/cell/{coordinate}
Body: "ALIVE" | "DEAD"
TODO - Generate this from Swagger
| key name | Type | What it does |
|---|---|---|
| current_universe | String | GUID pointing to the currently active universe |
| universes | List | Contains GUIDs of known universes |
| universe:{GUID} | Hash | Contains attributes of a universe |
| width | ||
| height | ||
| universe:{GUID}:generations | Hash | Contains hash of generations for a universe (Index, generation GUID) |
| generation:{GUID} | Hash | Hash of cells for each generation (CellID, CellState) |

