DEV-765 pipeline refactor (#64)

Refactor rulesets into smaller composable operations

In order to mix up the functionality from different rulesets like Solo, Royale, etc. the code in these classes needs to be broken up into small functions that can be composed in a pipeline to make a custom game mode.
This commit is contained in:
Torben 2022-03-16 16:58:05 -07:00 committed by GitHub
parent 5e629e9e93
commit 397d925110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 1475 additions and 222 deletions

View file

@ -11,13 +11,13 @@
"hazardMap": "",
"hazardMapAuthor": "",
"royale": {
"shrinkEveryNTurns": 25
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": true,
"sharedElimination": true,
"sharedHealth": true,
"sharedLength": true
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "constrictor",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "royale",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 17
},
"squad": {
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "solo",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "squad",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": true,
"sharedElimination": false,
"sharedHealth": true,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "standard",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}

View file

@ -0,0 +1,108 @@
{
"game": {
"id": "",
"ruleset": {
"name": "wrapped",
"version": "cli",
"settings": {
"foodSpawnChance": 11,
"minimumFood": 7,
"hazardDamagePerTurn": 19,
"hazardMap": "hz_spiral",
"hazardMapAuthor": "altersaddle",
"royale": {
"shrinkEveryNTurns": 0
},
"squad": {
"allowBodyCollisions": false,
"sharedElimination": false,
"sharedHealth": false,
"sharedLength": false
}
}
},
"timeout": 500,
"source": ""
},
"turn": 0,
"board": {
"height": 11,
"width": 11,
"snakes": [
{
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
},
{
"id": "two",
"name": "TWO",
"latency": "0",
"health": 0,
"body": [
{
"x": 4,
"y": 3
}
],
"head": {
"x": 4,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#654321",
"head": "silly",
"tail": "bolt"
}
}
],
"food": [],
"hazards": []
},
"you": {
"id": "one",
"name": "ONE",
"latency": "0",
"health": 0,
"body": [
{
"x": 3,
"y": 3
}
],
"head": {
"x": 3,
"y": 3
},
"length": 1,
"shout": "",
"squad": "",
"customizations": {
"color": "#123456",
"head": "safe",
"tail": "curled"
}
}
}