DEV 559: Refactor CLI and add customizations (#57)

* move snake API structs into a new client package

* add customizations to snake objects

* refactor and add support for passing snake customizations in games
This commit is contained in:
Rob O'Dwyer 2021-11-25 14:07:56 -08:00 committed by GitHub
parent 6140f232c2
commit 4a9dbbcaef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 665 additions and 197 deletions

View file

@ -1,14 +1,13 @@
{
"game": {
"id": "",
"timeout": 500,
"ruleset": {
"name": "standard",
"version": "cli",
"settings": {
"hazardDamagePerTurn": 14,
"foodSpawnChance": 15,
"minimumFood": 1,
"hazardDamagePerTurn": 14,
"royale": {
"shrinkEveryNTurns": 25
},
@ -19,18 +18,19 @@
"sharedLength": true
}
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"food": [],
"hazards": [],
"snakes": [
{
"id": "one",
"name": "",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
@ -38,18 +38,23 @@
"y": 3
}
],
"latency": "0",
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": ""
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
@ -57,20 +62,27 @@
"y": 3
}
],
"latency": "0",
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": ""
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
]
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
@ -78,13 +90,17 @@
"y": 3
}
],
"latency": "0",
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": ""
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}