board-game-engine 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board-game-engine.js +61 -53
- package/dist/board-game-engine.min.js +1 -1
- package/e2e/bge.spec.js +267 -0
- package/e2e/bgio-minimal.spec.js +70 -0
- package/e2e/examples.spec.js +34 -0
- package/e2e/fixtures/bge-checkers.html +39 -0
- package/e2e/fixtures/bge-minimal.html +43 -0
- package/e2e/fixtures/bge-ttt.html +45 -0
- package/e2e/fixtures/bgio-minimal-debug.html +47 -0
- package/e2e/fixtures/bgio-minimal.html +44 -0
- package/e2e/fixtures/minimal-game.json +4 -0
- package/examples/checkers.json +793 -0
- package/examples/connect-four.json +126 -0
- package/examples/eights.json +653 -0
- package/examples/index.html +219 -0
- package/examples/reversi.json +215 -0
- package/examples/tic-tac-toe.json +53 -0
- package/package.json +8 -5
- package/playwright-report/index.html +85 -0
- package/playwright.config.cjs +23 -0
- package/src/client/client.js +38 -29
- package/src/game-factory/bank/bank.js +1 -1
- package/src/game-factory/condition/is-full-condition.js +1 -1
- package/src/game-factory/condition/would-condition.js +1 -1
- package/src/game-factory/expand-game-rules.js +7 -12
- package/src/game-factory/move/move-factory.js +1 -1
- package/src/game-factory/space-group/space-group.js +1 -1
- package/src/index.js +1 -1
- package/src/utils/get-steps.js +1 -1
- package/test-results/.last-run.json +4 -0
- package/babel.config.js +0 -6
- package/board-game-engine.test.js +0 -7
- package/jest.config.js +0 -21
- package/tic-tac-toe-verbose.json +0 -54
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entities": [
|
|
3
|
+
{
|
|
4
|
+
"name": "mainGrid",
|
|
5
|
+
"entityType": "Grid",
|
|
6
|
+
"width": 7,
|
|
7
|
+
"height": 6
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "playerMarker",
|
|
11
|
+
"perPlayer": true,
|
|
12
|
+
"count": "Infinity"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"sharedBoard": [{"name": "mainGrid"}],
|
|
16
|
+
"minPlayers": 2,
|
|
17
|
+
"maxPlayers": 2,
|
|
18
|
+
"turn": {
|
|
19
|
+
"minMoves": 1,
|
|
20
|
+
"maxMoves": 1
|
|
21
|
+
},
|
|
22
|
+
"moves": {
|
|
23
|
+
"placePlayerMarker": {
|
|
24
|
+
"moveType": "PlaceNew",
|
|
25
|
+
"entity": {
|
|
26
|
+
"conditions": [{
|
|
27
|
+
"conditionType": "Is",
|
|
28
|
+
"matcher": {
|
|
29
|
+
"name": "playerMarker",
|
|
30
|
+
"player": {
|
|
31
|
+
"type": "ctxPath",
|
|
32
|
+
"path": ["currentPlayer"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}]
|
|
36
|
+
},
|
|
37
|
+
"arguments": {
|
|
38
|
+
"destination": {
|
|
39
|
+
"playerChoice": true,
|
|
40
|
+
"conditions": [
|
|
41
|
+
{
|
|
42
|
+
"conditionType": "Is",
|
|
43
|
+
"matcher": { "entityType": "Space" }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"conditionType": "Not",
|
|
47
|
+
"conditions": [{"conditionType": "Contains"}]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"conditionType": "Not",
|
|
51
|
+
"conditions": [
|
|
52
|
+
{
|
|
53
|
+
"target": {
|
|
54
|
+
"type": "relativeCoordinates",
|
|
55
|
+
"location": [0, 1]
|
|
56
|
+
},
|
|
57
|
+
"conditionType": "Not",
|
|
58
|
+
"conditions": [{"conditionType": "Contains"}]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"endIf": [
|
|
68
|
+
{
|
|
69
|
+
"conditions": [{
|
|
70
|
+
"conditionType": "Some",
|
|
71
|
+
"target": {
|
|
72
|
+
"matchMultiple": true,
|
|
73
|
+
"conditions": [{
|
|
74
|
+
"conditionType": "Is",
|
|
75
|
+
"matcher": { "entityType": "Space" }
|
|
76
|
+
}
|
|
77
|
+
]},
|
|
78
|
+
"conditions": [{
|
|
79
|
+
"conditionType": "InLine",
|
|
80
|
+
"target": {
|
|
81
|
+
"type": "contextPath",
|
|
82
|
+
"path": ["loopTarget"]
|
|
83
|
+
},
|
|
84
|
+
"sequence": [
|
|
85
|
+
{
|
|
86
|
+
"minCount": 4,
|
|
87
|
+
"conditions": [{
|
|
88
|
+
"conditionType": "ContainsSame",
|
|
89
|
+
"properties": ["player"]
|
|
90
|
+
}]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}]
|
|
94
|
+
}],
|
|
95
|
+
"result": {
|
|
96
|
+
"winner": {
|
|
97
|
+
"type": "contextPath",
|
|
98
|
+
"path": ["results", 0, "result", "entities", 0, "attributes", "player"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"conditions": [{
|
|
104
|
+
"conditionType": "Every",
|
|
105
|
+
"target": {
|
|
106
|
+
"matchMultiple": true,
|
|
107
|
+
"conditions": [
|
|
108
|
+
{
|
|
109
|
+
"conditionType": "Is",
|
|
110
|
+
"target": { "type": "Parent" },
|
|
111
|
+
"matcher": { "name": "mainGrid" }
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"conditions": [{
|
|
116
|
+
"target": {
|
|
117
|
+
"type": "contextPath",
|
|
118
|
+
"path": ["loopTarget"]
|
|
119
|
+
},
|
|
120
|
+
"conditionType": "Contains"
|
|
121
|
+
}]
|
|
122
|
+
}],
|
|
123
|
+
"result": { "draw": true }
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|