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.
@@ -0,0 +1,653 @@
1
+ {
2
+ "entities": [
3
+ {
4
+ "name": "score",
5
+ "perPlayer": true,
6
+ "displayProperties": ["value"],
7
+ "state": { "value": 0 }
8
+ },
9
+ {
10
+ "entityType": "Space",
11
+ "name": "hand",
12
+ "perPlayer": true,
13
+ "contentsHiddenFrom": "Others"
14
+ },
15
+ {
16
+ "entityType": "Space",
17
+ "name": "discard"
18
+ },
19
+ {
20
+ "entityType": "Space",
21
+ "name": "stock",
22
+ "contentsHiddenFrom": "All"
23
+ },
24
+ {"value": 1, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
25
+ {"value": 2, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
26
+ {"value": 3, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
27
+ {"value": 4, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
28
+ {"value": 5, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
29
+ {"value": 6, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
30
+ {"value": 7, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
31
+ {"value": 8, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
32
+ {"value": 9, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
33
+ {"value": 10, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
34
+ {"value": 11, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
35
+ {"value": 12, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
36
+ {"value": 13, "suit": "clubs", "displayProperties": ["value", "suit"], "name": "card"},
37
+ {"value": 1, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
38
+ {"value": 2, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
39
+ {"value": 3, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
40
+ {"value": 4, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
41
+ {"value": 5, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
42
+ {"value": 6, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
43
+ {"value": 7, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
44
+ {"value": 8, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
45
+ {"value": 9, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
46
+ {"value": 10, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
47
+ {"value": 11, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
48
+ {"value": 12, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
49
+ {"value": 13, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
50
+ {"value": 13, "suit": "hearts", "displayProperties": ["value", "suit"], "name": "card"},
51
+ {"value": 1, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
52
+ {"value": 2, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
53
+ {"value": 3, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
54
+ {"value": 4, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
55
+ {"value": 5, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
56
+ {"value": 6, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
57
+ {"value": 7, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
58
+ {"value": 8, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
59
+ {"value": 9, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
60
+ {"value": 10, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
61
+ {"value": 11, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
62
+ {"value": 12, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
63
+ {"value": 13, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
64
+ {"value": 13, "suit": "spades", "displayProperties": ["value", "suit"], "name": "card"},
65
+ {"value": 1, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
66
+ {"value": 2, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
67
+ {"value": 3, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
68
+ {"value": 4, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
69
+ {"value": 5, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
70
+ {"value": 6, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
71
+ {"value": 7, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
72
+ {"value": 8, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
73
+ {"value": 9, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
74
+ {"value": 10, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
75
+ {"value": 11, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
76
+ {"value": 12, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
77
+ {"value": 13, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"},
78
+ {"value": 13, "suit": "diamonds", "displayProperties": ["value", "suit"], "name": "card"}
79
+ ],
80
+ "sharedBoard": [
81
+ { "name": "stock" },
82
+ { "name": "discard" }
83
+ ],
84
+ "personalBoard": [
85
+ { "name": "hand" },
86
+ { "name": "score" }
87
+ ],
88
+ "initialMoves": [
89
+ {
90
+ "moveType": "PlaceNew",
91
+ "matchMultiple": true,
92
+ "entity": {
93
+ "conditions": [{
94
+ "conditionType": "Is",
95
+ "matcher": { "name": "card" }
96
+ }]
97
+ },
98
+ "arguments": {
99
+ "destination": {
100
+ "conditions": [{
101
+ "conditionType": "Is",
102
+ "matcher": { "name": "stock" }
103
+ }]
104
+ }
105
+ }
106
+ }
107
+ ],
108
+ "minPlayers": 2,
109
+ "maxPlayers": 5,
110
+ "phases": {
111
+ "play": {
112
+ "start": true,
113
+ "next": "score",
114
+ "initialMoves": [
115
+ {
116
+ "moveType": "MoveEntity",
117
+ "arguments": {
118
+ "entity": {
119
+ "matchMultiple": true,
120
+ "conditions": [{
121
+ "conditionType": "Is",
122
+ "matcher": { "name": "card" }
123
+ }]
124
+ },
125
+ "destination": {
126
+ "conditions": [{
127
+ "conditionType": "Is",
128
+ "matcher": { "name": "stock" }
129
+ }]
130
+ }
131
+ }
132
+ },
133
+ {
134
+ "moveType": "Shuffle",
135
+ "arguments": {
136
+ "target": {
137
+ "conditions": [{
138
+ "conditionType": "Is",
139
+ "matcher": { "name": "stock" }
140
+ }]
141
+ }
142
+ }
143
+ },
144
+ {
145
+ "moveType": "ForEach",
146
+ "arguments": {
147
+ "targets": [0,1,2,3,4]
148
+ },
149
+ "move": {
150
+ "moveType": "ForEach",
151
+ "arguments": {
152
+ "targets": {
153
+ "type": "ctxPath",
154
+ "path": ["playOrder"]
155
+ }
156
+ },
157
+ "move": {
158
+ "moveType": "MoveEntity",
159
+ "arguments": {
160
+ "entity": {
161
+ "conditions": [
162
+ {
163
+ "conditionType": "Is",
164
+ "target": { "type": "Parent" },
165
+ "matcher": { "name": "stock" }
166
+ },
167
+ {
168
+ "conditionType": "Position",
169
+ "position": "First"
170
+ }
171
+ ]
172
+ },
173
+ "destination": {
174
+ "conditions": [
175
+ {
176
+ "conditionType": "Is",
177
+ "matcher": {
178
+ "name": "hand",
179
+ "player": {
180
+ "type": "contextPath",
181
+ "path": ["loopTarget"]
182
+ }
183
+ }
184
+ }
185
+ ]
186
+ }
187
+ }
188
+ }
189
+ }
190
+ },
191
+ {
192
+ "moveType": "MoveEntity",
193
+ "arguments": {
194
+ "entity": {
195
+ "conditions": [
196
+ {
197
+ "conditionType": "Is",
198
+ "target": { "type": "Parent" },
199
+ "matcher": { "name": "stock" }
200
+ },
201
+ {
202
+ "conditionType": "Position",
203
+ "position": "First"
204
+ }
205
+ ]
206
+ },
207
+ "destination": {
208
+ "conditions": [
209
+ {
210
+ "conditionType": "Is",
211
+ "matcher": {
212
+ "name": "discard"
213
+ }
214
+ }
215
+ ]
216
+ }
217
+ }
218
+ }
219
+ ],
220
+ "turn": {
221
+ "order": {
222
+ "playOrder": "RotateFirst"
223
+ },
224
+ "activePlayers": { "currentPlayer": "normalPlay" },
225
+ "initialMoves": [
226
+ {
227
+ "moveType": "ForEach",
228
+ "arguments": {
229
+ "targets": {
230
+ "matchMultiple": true,
231
+ "conditions": [
232
+ {
233
+ "conditionType": "Is",
234
+ "target": { "type": "Parent" },
235
+ "matcher": { "name": "discard" }
236
+ },
237
+ {
238
+ "conditionType": "Not",
239
+ "conditions": [{
240
+ "conditionType": "Position",
241
+ "position": "First"
242
+ }]
243
+ }
244
+ ]
245
+ }
246
+ },
247
+ "conditions": [{
248
+ "conditionType": "Not",
249
+ "target": {
250
+ "conditions": [{
251
+ "conditionType": "Is",
252
+ "matcher": { "name": "stock" }
253
+ }]
254
+ },
255
+ "conditions": [{ "conditionType": "Contains" }]
256
+ }],
257
+ "move": {
258
+ "moveType": "MoveEntity",
259
+ "arguments": {
260
+ "entity": {
261
+ "type": "contextPath",
262
+ "path": ["loopTarget"]
263
+ },
264
+ "destination": {
265
+ "conditions": [
266
+ {
267
+ "conditionType": "Is",
268
+ "matcher": {
269
+ "name": "stock"
270
+ }
271
+ }
272
+ ]
273
+ }
274
+ }
275
+ }
276
+ },
277
+ {
278
+ "moveType": "Shuffle",
279
+ "arguments": {
280
+ "target": {
281
+ "conditions": [{
282
+ "conditionType": "Is",
283
+ "matcher": { "name": "stock" }
284
+ }]
285
+ }
286
+ }
287
+ }
288
+ ],
289
+ "stages": {
290
+ "normalPlay": {
291
+ "moves": {
292
+ "playCard": {
293
+ "moveType": "MoveEntity",
294
+ "position": "First",
295
+ "arguments": {
296
+ "entity": {
297
+ "playerChoice": true,
298
+ "conditions": [
299
+ {
300
+ "conditionType": "Is",
301
+ "target": { "type": "Parent" },
302
+ "matcher": {
303
+ "name": "hand",
304
+ "player": {
305
+ "type": "ctxPath",
306
+ "path": ["currentPlayer"]
307
+ }
308
+ }
309
+ },
310
+ {
311
+ "conditionType": "Or",
312
+ "conditions": [
313
+ {
314
+ "conditionType": "Is",
315
+ "matcher": {
316
+ "value": 8
317
+ }
318
+ },
319
+ {
320
+ "conditionType": "Is",
321
+ "matcher": {
322
+ "type": "Pick",
323
+ "properties": ["suit"],
324
+ "target": {
325
+ "conditions": [
326
+ {
327
+ "conditionType": "Is",
328
+ "target": { "type": "Parent" },
329
+ "matcher": { "name": "discard" }
330
+ },
331
+ {
332
+ "conditionType": "Position",
333
+ "position": "First"
334
+ }
335
+ ]
336
+ }
337
+ }
338
+ },
339
+ {
340
+ "conditionType": "Is",
341
+ "matcher": {
342
+ "type": "Pick",
343
+ "properties": ["value"],
344
+ "target": {
345
+ "conditions": [
346
+ {
347
+ "conditionType": "Is",
348
+ "target": { "type": "Parent" },
349
+ "matcher": { "name": "discard" }
350
+ },
351
+ {
352
+ "conditionType": "Position",
353
+ "position": "First"
354
+ }
355
+ ]
356
+ }
357
+ }
358
+ }
359
+ ]
360
+ }
361
+ ]
362
+ },
363
+ "destination": {
364
+ "position": "First",
365
+ "conditions": [
366
+ {
367
+ "conditionType": "Is",
368
+ "matcher": { "name": "discard" }
369
+ }
370
+ ]
371
+ }
372
+ },
373
+ "then": [
374
+ {
375
+ "moveType": "SetActivePlayers",
376
+ "options": {
377
+ "currentPlayer": {
378
+ "stage": "nameSuit"
379
+ }
380
+ },
381
+ "conditions": [{
382
+ "conditionType": "Is",
383
+ "target": {
384
+ "type": "contextPath",
385
+ "path": ["previousArguments", "entity"]
386
+ },
387
+ "matcher": { "value": 8 }
388
+ }]
389
+ },
390
+ {
391
+ "moveType": "EndTurn",
392
+ "conditions": [{
393
+ "conditionType": "Not",
394
+ "target": {
395
+ "type": "contextPath",
396
+ "path": ["previousArguments", "entity"]
397
+ },
398
+ "conditions": [{
399
+ "conditionType": "Is",
400
+ "matcher": { "value": 8 }
401
+ }]
402
+ }]
403
+ }
404
+ ]
405
+ },
406
+ "takeCard": {
407
+ "moveType": "TakeFrom",
408
+ "conditions": [{
409
+ "conditionType": "Contains",
410
+ "target": {
411
+ "conditions": [{
412
+ "conditionType": "Is",
413
+ "matcher": { "name": "stock" }
414
+ }]
415
+ }
416
+ }],
417
+ "arguments": {
418
+ "source": {
419
+ "playerChoice": true,
420
+ "conditions": [
421
+ {
422
+ "conditionType": "Is",
423
+ "matcher": { "name": "stock" }
424
+ }
425
+ ]
426
+ },
427
+ "destination": {
428
+ "conditions": [
429
+ {
430
+ "conditionType": "Is",
431
+ "matcher": {
432
+ "name": "hand",
433
+ "player": {
434
+ "type": "ctxPath",
435
+ "path": ["currentPlayer"]
436
+ }
437
+ }
438
+ }
439
+ ]
440
+ }
441
+ },
442
+ "then": [{ "moveType": "EndTurn" }]
443
+ }
444
+ }
445
+ },
446
+ "nameSuit": {
447
+ "moves": {
448
+ "nameSuit": {
449
+ "moveType": "SetState",
450
+ "arguments": {
451
+ "entity": {
452
+ "conditions": [
453
+ {
454
+ "conditionType": "Is",
455
+ "target": { "type": "Parent" },
456
+ "matcher": { "name": "discard" }
457
+ },
458
+ {
459
+ "conditionType": "Position",
460
+ "position": "First"
461
+ }
462
+ ]
463
+ },
464
+ "state": {
465
+ "playerChoice": true,
466
+ "property": "suit",
467
+ "possibleValues": [ "clubs", "hearts", "spades", "diamonds" ]
468
+ }
469
+ },
470
+ "then": [{ "moveType": "EndTurn" }]
471
+ }
472
+ }
473
+ }
474
+ }
475
+ },
476
+ "endIf": [{
477
+ "conditions": [{
478
+ "conditionType": "Is",
479
+ "target": {
480
+ "conditions": [
481
+ {
482
+ "conditionType": "Is",
483
+ "matcher": { "name": "hand" }
484
+ },
485
+ {
486
+ "conditionType": "Not",
487
+ "conditions": [{ "conditionType": "Contains" }]
488
+ }
489
+ ]
490
+ }
491
+ }]
492
+ }]
493
+ },
494
+ "score": {
495
+ "next": "play",
496
+ "initialMoves": [
497
+ {
498
+ "moveType": "ForEach",
499
+ "arguments": {
500
+ "targets": {
501
+ "type": "ctxPath",
502
+ "path": ["playOrder"]
503
+ }
504
+ },
505
+ "move": {
506
+ "moveType": "SetState",
507
+ "arguments": {
508
+ "entity": {
509
+ "conditions": [
510
+ {
511
+ "conditionType": "Is",
512
+ "matcher": {
513
+ "name": "score",
514
+ "player": {
515
+ "type": "RelativePath",
516
+ "target": {
517
+ "conditions": [
518
+ {
519
+ "conditionType": "Is",
520
+ "matcher": { "name": "hand" }
521
+ },
522
+ {
523
+ "conditionType": "Not",
524
+ "conditions": [{ "conditionType": "Contains" }]
525
+ }
526
+ ]
527
+ },
528
+ "path": ["player"]
529
+ }
530
+ }
531
+ }
532
+ ]
533
+ },
534
+ "state": {
535
+ "property": "value",
536
+ "value": {
537
+ "type": "expression",
538
+ "expression": "existingScore + sum(faceValues)",
539
+ "arguments": {
540
+ "existingScore": {
541
+ "type": "RelativePath",
542
+ "target": {
543
+ "conditions": [
544
+ {
545
+ "conditionType": "Is",
546
+ "matcher": {
547
+ "name": "score",
548
+ "player": {
549
+ "type": "RelativePath",
550
+ "target": {
551
+ "conditions": [
552
+ {
553
+ "conditionType": "Is",
554
+ "matcher": { "name": "hand" }
555
+ },
556
+ {
557
+ "conditionType": "Not",
558
+ "conditions": [{ "conditionType": "Contains" }]
559
+ }
560
+ ]
561
+ },
562
+ "path": ["player"]
563
+ }
564
+ }
565
+ }
566
+ ]
567
+ },
568
+ "path": ["value"]
569
+ },
570
+ "faceValues": {
571
+ "type": "map",
572
+ "targets": {
573
+ "matchMultiple": true,
574
+ "conditions": [
575
+ {
576
+ "conditionType": "Is",
577
+ "target": { "type": "Parent" },
578
+ "matcher": {
579
+ "name": "hand",
580
+ "player": {
581
+ "type": "contextPath",
582
+ "path": [ "loopTarget" ]
583
+ }
584
+ }
585
+ }
586
+ ]
587
+ },
588
+ "mapping": {
589
+ "type": "expression",
590
+ "expression": "cardValue == 8 ? 50 : (cardValue >= 10 and cardValue <= 13) ? 10 : cardValue",
591
+ "arguments": {
592
+ "cardValue": {
593
+ "conditionType": "RelativePath",
594
+ "target": {
595
+
596
+ "type": "contextPath",
597
+ "path": ["loopTarget"]
598
+ },
599
+ "path": ["value"]
600
+ }
601
+ }
602
+ }
603
+ }
604
+ }
605
+ }
606
+ }
607
+ }
608
+ }
609
+ },
610
+ { "moveType": "EndTurn" }
611
+ ]
612
+ }
613
+ },
614
+ "endIf": [{
615
+ "conditions": [{
616
+ "conditionType": "Some",
617
+ "target": {
618
+ "matchMultiple": true,
619
+ "conditions": [{
620
+ "conditionType": "Is",
621
+ "matcher": { "name": "score" }
622
+ }
623
+ ]},
624
+ "conditions": [
625
+ {
626
+ "conditionType": "Evaluate",
627
+ "expression": "score >= numPlayers * 50",
628
+ "arguments": {
629
+ "score": {
630
+ "type": "RelativePath",
631
+ "target": {
632
+ "type": "contextPath",
633
+ "path": ["loopTarget"]
634
+ },
635
+ "path": ["value"]
636
+ },
637
+ "numPlayers": {
638
+
639
+ "type": "ctxPath",
640
+ "path": ["playOrder", "length"]
641
+ }
642
+ }
643
+ }
644
+ ]
645
+ }],
646
+ "result": {
647
+ "winner": {
648
+ "type": "contextPath",
649
+ "path": ["results",0,"result","rule","player"]
650
+ }
651
+ }
652
+ }]
653
+ }