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:
parent
6140f232c2
commit
4a9dbbcaef
10 changed files with 665 additions and 197 deletions
90
client/fixtures_test.go
Normal file
90
client/fixtures_test.go
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
package client
|
||||
|
||||
func exampleSnakeRequest() SnakeRequest {
|
||||
return SnakeRequest{
|
||||
Game: Game{
|
||||
ID: "game-id",
|
||||
Ruleset: Ruleset{
|
||||
Name: "test-ruleset-name",
|
||||
Version: "cli",
|
||||
Settings: exampleRulesetSettings,
|
||||
},
|
||||
Timeout: 33,
|
||||
Source: "league",
|
||||
},
|
||||
Turn: 11,
|
||||
Board: Board{
|
||||
Height: 22,
|
||||
Width: 11,
|
||||
Snakes: []Snake{
|
||||
{
|
||||
ID: "snake-0",
|
||||
Name: "snake-0-name",
|
||||
Latency: "snake-0-latency",
|
||||
Health: 100,
|
||||
Body: []Coord{{X: 1, Y: 2}, {X: 1, Y: 3}, {X: 1, Y: 4}},
|
||||
Head: Coord{X: 1, Y: 2},
|
||||
Length: 3,
|
||||
Shout: "snake-0-shout",
|
||||
Squad: "",
|
||||
Customizations: Customizations{
|
||||
Head: "safe",
|
||||
Tail: "curled",
|
||||
Color: "#123456",
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "snake-1",
|
||||
Name: "snake-1-name",
|
||||
Latency: "snake-1-latency",
|
||||
Health: 200,
|
||||
Body: []Coord{{X: 2, Y: 2}, {X: 2, Y: 3}, {X: 2, Y: 4}},
|
||||
Head: Coord{X: 2, Y: 2},
|
||||
Length: 3,
|
||||
Shout: "snake-1-shout",
|
||||
Squad: "snake-1-squad",
|
||||
Customizations: Customizations{
|
||||
Head: "silly",
|
||||
Tail: "bolt",
|
||||
Color: "#654321",
|
||||
},
|
||||
},
|
||||
},
|
||||
Food: []Coord{{X: 2, Y: 2}},
|
||||
Hazards: []Coord{{X: 8, Y: 8}, {X: 9, Y: 9}},
|
||||
},
|
||||
You: Snake{
|
||||
ID: "snake-1",
|
||||
Name: "snake-1-name",
|
||||
Latency: "snake-1-latency",
|
||||
Health: 200,
|
||||
Body: []Coord{{X: 2, Y: 2}, {X: 2, Y: 3}, {X: 2, Y: 4}},
|
||||
Head: Coord{X: 2, Y: 2},
|
||||
Length: 3,
|
||||
Shout: "snake-1-shout",
|
||||
Squad: "snake-1-squad",
|
||||
Customizations: Customizations{
|
||||
Head: "silly",
|
||||
Tail: "bolt",
|
||||
Color: "#654321",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var exampleRulesetSettings = RulesetSettings{
|
||||
FoodSpawnChance: 10,
|
||||
MinimumFood: 20,
|
||||
HazardDamagePerTurn: 30,
|
||||
|
||||
RoyaleSettings: RoyaleSettings{
|
||||
ShrinkEveryNTurns: 40,
|
||||
},
|
||||
|
||||
SquadSettings: SquadSettings{
|
||||
AllowBodyCollisions: true,
|
||||
SharedElimination: true,
|
||||
SharedHealth: true,
|
||||
SharedLength: true,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue