summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2024-01-04 13:36:22 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commit428cd0cf47e504e5301878b49eeeeec73159a87a (patch)
tree3d108b92185bc93d8c0f171bd6fcc3b5c1c5363f
parent2d00a300ea727b1d7020463471a4a3ee3577e195 (diff)
downloadtable-battles-428cd0cf47e504e5301878b49eeeeec73159a87a.tar.gz
JSON Schema for fuzzer
-rw-r--r--rules.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index d486457..afb281d 100644
--- a/rules.js
+++ b/rules.js
@@ -111,6 +111,42 @@ exports.action = function (state, player, action, arg) {
return game
}
+// JSON Schema for view data
+exports.VIEW_SCHEMA = {
+ type: "object",
+ properties: {
+ log: {type: "array", items: {type: "string"}},
+ prompt: {type: "string"},
+ scenario: {type: "integer"},
+
+ dice: {type: "array", minItems: 24, maxItems: 24, items: {type: "integer", minimum: -1}},
+ sticks: {type: "array", items: {type: "integer", minimum: 0}},
+ cubes: {type: "array", items: {type: "integer", minimum: 0}},
+
+ morale: {type: "array", minItems: 2, maxItems: 2, items: {type: "integer", minimum: 0}},
+ tv1: {type: "integer", minimum: 0},
+ tv2: {type: "integer", minimum: 0},
+ front: {type: "array", items: {type: "array", items: {type: "integer", minimum: 0}}},
+ reserve: {type: "array", items: {type: "array", items: {type: "integer", minimum: 0}}},
+
+ selected: {type: "integer", minimum: -1},
+ target: {type: "integer", minimum: -1},
+ hits: {type: "integer", minimum: 0},
+ self: {type: "integer", minimum: 0},
+
+ shift: {type: "array", items: {type: "integer", minimum: 0}},
+ target2: {type: "integer", minimum: 0},
+ hits2: {type: "integer", minimum: 0},
+
+ actions: {type: "object"},
+ },
+ required: [
+ "log", "prompt", "scenario", "dice", "sticks", "cubes", "morale", "tv1", "tv2",
+ "front", "reserve", "selected", "target", "hits", "self"
+ ],
+ additionalProperties: false
+}
+
exports.view = function (state, player) {
game = state