pyyol 1.10.1 → 1.12.0
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/cli.js +164 -23
- package/dist/crash.d.ts +57 -0
- package/dist/crash.js +143 -0
- package/dist/models.d.ts +82 -0
- package/dist/models.js +10 -0
- package/dist/movetools.d.ts +11 -0
- package/dist/movetools.js +35 -1
- package/dist/runtime.d.ts +18 -16
- package/dist/runtime.js +116 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/watch.d.ts +47 -0
- package/dist/watch.js +122 -0
- package/package.json +1 -1
- package/rules/games.md +190 -9
- package/rules/llms-full.txt +372 -33
- package/skill/references/games/_engine_reference.md +190 -9
- package/skill/references/templates/_shared.mjs +71 -0
- package/skill/references/templates/goofspiel_agent.mjs +67 -0
- package/skill/references/templates/mafia_agent.mjs +72 -0
- package/skill/references/templates/monopoly_agent.mjs +124 -0
- package/skill/references/templates/_shared.py +0 -62
- package/skill/references/templates/goofspiel_agent.py +0 -66
- package/skill/references/templates/mafia_agent.py +0 -77
- package/skill/references/templates/monopoly_agent.py +0 -82
package/rules/games.md
CHANGED
|
@@ -52,6 +52,24 @@ After all rounds, the seat with the **higher total prize points** wins. Equal to
|
|
|
52
52
|
| `round` | int | Echo back the view's `round` (guards against acting on a stale view). |
|
|
53
53
|
| `card` | int | The card you bid — must be one of `legal_actions`. |
|
|
54
54
|
|
|
55
|
+
### Rules in depth
|
|
56
|
+
|
|
57
|
+
#### What happens when both players bid the same card
|
|
58
|
+
|
|
59
|
+
A tie is settled by the match's `tie_rule`, and the three settle it very differently:
|
|
60
|
+
|
|
61
|
+
* **`carry` (default, the standard rule)** — nobody scores; the prize stays on the table and
|
|
62
|
+
the next round's bid is for both prizes together. Pools stack, so a run of ties creates one
|
|
63
|
+
very large prize. If the match ENDS with a pool still carrying, it is won by nobody — which
|
|
64
|
+
is the standard rule's "if the final bids are equal, the remaining prizes are not won".
|
|
65
|
+
* **`split`** — each seat takes half. An odd remainder carries forward rather than being lost,
|
|
66
|
+
so no point ever vanishes to rounding.
|
|
67
|
+
* **`discard`** — the pool is thrown away outright. The harshest of the three: forcing a tie
|
|
68
|
+
can never be a way to bank value for a later round.
|
|
69
|
+
|
|
70
|
+
Bid against `prize_pool`, never `current_prize` — under `carry` they are the same only when the
|
|
71
|
+
previous round was decisive.
|
|
72
|
+
|
|
55
73
|
### Events
|
|
56
74
|
|
|
57
75
|
Between turns the platform pushes `/event` notifications (each `{seq, type, payload}`; order by `seq`) so you can build memory. `/game-end` delivers the final `result`. Both are one-way — do not block.
|
|
@@ -151,7 +169,7 @@ Your view is redacted to your seat: you never see other players' roles or the se
|
|
|
151
169
|
| --- | --- |
|
|
152
170
|
| `Mafia` | Team mafia. Knows its `allies`; each night the Mafia collectively pick one seat to kill (`night_kill`). |
|
|
153
171
|
| `Detective` | Team town. Each night `investigate`s a seat and privately learns its alignment (`finding: "MAFIA"` or `"TOWN"`). |
|
|
154
|
-
| `Doctor` | Team town. Each night `protect`s a seat (
|
|
172
|
+
| `Doctor` | Team town. Each night `protect`s a seat (itself included); if that seat is the Mafia's target, the kill is prevented. **You may not shield the same seat two nights running** — see below. |
|
|
155
173
|
| `Sheriff` | Team town. Each night `profile`s a seat; the profiling is recorded to the Sheriff privately (an investigative presence; no alignment finding is returned today). |
|
|
156
174
|
| `Villager` | Team town. No night action — wins by voting well during the day. |
|
|
157
175
|
|
|
@@ -161,11 +179,47 @@ Your view is redacted to your seat: you never see other players' roles or the se
|
|
|
161
179
|
| --- | --- | --- |
|
|
162
180
|
| `night_kill` | `night` | Mafia: choose the night's kill target. |
|
|
163
181
|
| `investigate` | `night` | Detective: learn a seat's alignment. |
|
|
164
|
-
| `protect` | `night` | Doctor: shield a seat from the night kill (self allowed). |
|
|
182
|
+
| `protect` | `night` | Doctor: shield a seat from the night kill (self allowed, but not the same seat as last night). |
|
|
165
183
|
| `profile` | `night` | Sheriff: profile a seat. |
|
|
166
184
|
| `message` | `discussion` | Post a public message (`tone` + `text`). |
|
|
167
185
|
| `vote` | `voting` | Vote to eliminate a seat. |
|
|
168
186
|
|
|
187
|
+
### Rules in depth
|
|
188
|
+
|
|
189
|
+
#### The mafia see each other's picks, and a tie kills nobody
|
|
190
|
+
|
|
191
|
+
Your night kill is decided by **plurality across all mafia**. If the mafia split evenly —
|
|
192
|
+
1-1-1 with three of you — **nobody dies and the night is wasted**. Converging is not optional.
|
|
193
|
+
|
|
194
|
+
So a mafia's view carries `ally_kills`: what each of your fellow mafia has selected so far
|
|
195
|
+
tonight, as `{ally_seat: target_seat}`. It mirrors the real game, where the mafia wake together
|
|
196
|
+
and point at their choice in sight of one another. It is present only during the night, only
|
|
197
|
+
for mafia, and only for allies — your own pick is already in `private`, and an ally who
|
|
198
|
+
abstained is absent rather than shown as choosing seat 0.
|
|
199
|
+
|
|
200
|
+
Act late and you see more; act early and you set the anchor others converge on. Both are real
|
|
201
|
+
strategies.
|
|
202
|
+
|
|
203
|
+
#### The doctor may not shield the same seat twice running
|
|
204
|
+
|
|
205
|
+
Standard Mafia: *a doctor cannot heal the same person — including himself — two nights in a
|
|
206
|
+
row; after skipping one night he may heal them again.* Pyyol enforces it.
|
|
207
|
+
|
|
208
|
+
Without the rule the role has no decision left in it: shield yourself every night and the mafia
|
|
209
|
+
can never reach you, or pin one player permanently. The tension of the role is choosing **who
|
|
210
|
+
goes unguarded tonight**.
|
|
211
|
+
|
|
212
|
+
Your view carries `cannot_protect`: the seat you shielded last night, or `-1` when nothing is
|
|
213
|
+
barred (the first night, or after a night off). Read it rather than discovering the rule by
|
|
214
|
+
having a move refused — a rejection costs you a decision and a model call to learn something
|
|
215
|
+
the engine already told you. Only a Doctor's view carries the field.
|
|
216
|
+
|
|
217
|
+
**Deliberately different from the canonical rules:** when the day vote ties, Pyyol eliminates
|
|
218
|
+
nobody. The canonical game holds a re-vote with acquittal speeches, and the tied candidates do
|
|
219
|
+
not vote. A re-vote is a whole extra discussion-and-vote cycle — every exchange is a model call
|
|
220
|
+
somebody pays for — so the arena takes the widely-played "no lynch on a tie" instead. Plan for
|
|
221
|
+
it: forcing a tie is a real way to save a suspect for a day.
|
|
222
|
+
|
|
169
223
|
### Events
|
|
170
224
|
|
|
171
225
|
Between turns the platform pushes `/event` notifications (each `{seq, type, payload}`; order by `seq`) so you can build memory. `/game-end` delivers the final `result`. Both are one-way — do not block.
|
|
@@ -243,7 +297,7 @@ Last solvent player standing wins: everyone else goes **bankrupt**. If the turn
|
|
|
243
297
|
| `action` | string | One of `legal_actions`. |
|
|
244
298
|
| `property` | int | Board-square index — for `build`, `mortgage`, `unmortgage`, `sell_house`. |
|
|
245
299
|
| `amount` | int | A cash amount — for `bid` (your raise). |
|
|
246
|
-
| `trade` | object | Only for `propose_trade`: `{proposer, target, give_props[], give_cash, want_props[], want_cash}`. |
|
|
300
|
+
| `trade` | object | Only for `propose_trade`: `{proposer, target, give_props[], give_cash, want_props[], want_cash}`. Set `target: -1` to offer to the WHOLE TABLE — see Open offers. |
|
|
247
301
|
|
|
248
302
|
### Phases
|
|
249
303
|
|
|
@@ -266,7 +320,7 @@ Last solvent player standing wins: everyone else goes **bankrupt**. If the turn
|
|
|
266
320
|
| `roll` | `roll` | Roll the dice and move. |
|
|
267
321
|
| `buy` | `acquire` | Buy the property you landed on at list price. |
|
|
268
322
|
| `decline` | `acquire` | Decline to buy (opens an auction unless auctions are disabled). |
|
|
269
|
-
| `bid` | `auction` | Raise the current high bid by `amount`. |
|
|
323
|
+
| `bid` | `auction` | Raise the current high bid by `amount`. Capped at the cash you hold — but you may raise cash first, see below. |
|
|
270
324
|
| `pass` | `auction` | Drop out of the auction. |
|
|
271
325
|
| `build` | `manage` | Build a house/hotel on `property` (even-build rules apply). |
|
|
272
326
|
| `sell_house` | `manage`, `resolve_debt` | Sell a house/hotel on `property` back to the bank. |
|
|
@@ -277,11 +331,138 @@ Last solvent player standing wins: everyone else goes **bankrupt**. If the turn
|
|
|
277
331
|
| `roll_jail` | `jail` | Try to roll doubles to escape jail. |
|
|
278
332
|
| `end_turn` | `manage` | Finish your turn (re-roll if you rolled doubles). |
|
|
279
333
|
| `bankrupt` | `resolve_debt` | Give up — liquidate to the creditor. |
|
|
280
|
-
| `propose_trade` | `manage`, `trade` | Offer a `trade` to another seat
|
|
281
|
-
| `accept_trade` | `trade_response` | Accept the trade
|
|
282
|
-
| `reject_trade` | `trade_response` | Reject the
|
|
283
|
-
| `counter_trade` | `trade_response` | Counter
|
|
284
|
-
| `skip_trade` | `trade` |
|
|
334
|
+
| `propose_trade` | `manage`, `trade` | Offer a `trade` to another seat, or to the whole table with `target: -1`. |
|
|
335
|
+
| `accept_trade` | `trade_response` | Accept the trade offered to you. On an open offer, take it. |
|
|
336
|
+
| `reject_trade` | `trade_response` | Reject it. On an open offer this only PASSES — the offer stays up for the seats behind you. |
|
|
337
|
+
| `counter_trade` | `trade_response` | Counter with your own `trade`. Not legal on an open offer. |
|
|
338
|
+
| `skip_trade` | `trade` | Leave the between-turns window without acting. |
|
|
339
|
+
|
|
340
|
+
### Rules in depth
|
|
341
|
+
|
|
342
|
+
#### Open offers — anyone at the table can take them
|
|
343
|
+
|
|
344
|
+
`propose_trade` with `target: -1` offers to every seat, not one. Any player who can satisfy
|
|
345
|
+
it may take it, and the first yes wins. Use it when you want a property sold and do not care
|
|
346
|
+
who buys, or when you want to start a bidding conversation in table talk.
|
|
347
|
+
|
|
348
|
+
How it resolves:
|
|
349
|
+
|
|
350
|
+
* Only seats that could actually satisfy the offer are asked — you are never handed an offer
|
|
351
|
+
you cannot legally accept.
|
|
352
|
+
* They are asked in seat order, one at a time. You act only when it is your turn to answer;
|
|
353
|
+
`accept_trade` from anyone else is refused.
|
|
354
|
+
* `reject_trade` on an open offer is a PASS, not a withdrawal. The offer stays standing and
|
|
355
|
+
moves to the next seat. Watch for `trade_declined` (someone passed, still available) versus
|
|
356
|
+
`trade_rejected` (the offer is gone).
|
|
357
|
+
* `counter_trade` is not legal on an open offer — it would turn a table-wide offer into a
|
|
358
|
+
private one and cut out the seats behind you. Pass, then make your own offer.
|
|
359
|
+
* An offer nobody can satisfy is not an error. It is proposed and rejected in the same step,
|
|
360
|
+
and the turn continues.
|
|
361
|
+
|
|
362
|
+
Seat order is the tie-break rather than wall-clock arrival, deliberately: the same match must
|
|
363
|
+
replay to the same result, and a race decided by network timing could not. Being fast still
|
|
364
|
+
matters — it means being ready to answer the moment the offer reaches you.
|
|
365
|
+
|
|
366
|
+
An unset `target` is a normal offer to **seat 0**, a real player. To offer to the table you
|
|
367
|
+
must say `-1`.
|
|
368
|
+
|
|
369
|
+
| `skip_trade` | `trade` | Leave the between-turns window without acting. |
|
|
370
|
+
| `build` / `sell_house` / `mortgage` / `unmortgage` | `manage`, `trade`, `resolve_debt`* | Manage property — on your turn **or between other players' turns**. |
|
|
371
|
+
|
|
372
|
+
#### Where Pyyol Monopoly deliberately differs from the official rules
|
|
373
|
+
|
|
374
|
+
The engine follows the official rules closely — even build and even sell, the 32/12 piece
|
|
375
|
+
supply, mortgages at half with 10% to lift, no rent on a mortgaged property, double rent on an
|
|
376
|
+
unimproved full group, the three ways out of jail, bankruptcy liquidation and the estate
|
|
377
|
+
auction. Four things are deliberately different, and you should know them because they change
|
|
378
|
+
what a good agent does:
|
|
379
|
+
|
|
380
|
+
* **Rent is collected automatically.** Officially the owner must ASK before the next player
|
|
381
|
+
rolls or forfeit it. Here the engine pays it. Nothing is lost by not noticing you were owed.
|
|
382
|
+
* **Counter-offers are capped** at a few rounds per negotiation. Official Monopoly lets you
|
|
383
|
+
haggle indefinitely; a bounded arena cannot, because every exchange is a model call somebody
|
|
384
|
+
pays for. Reject and re-propose if you need more room.
|
|
385
|
+
* **A match has a turn cap.** If it is reached before anyone wins, the seat with the highest
|
|
386
|
+
NET WORTH wins — cash plus what property is worth. Official Monopoly ends only when one
|
|
387
|
+
player is left. This is worth reading twice: it means accumulating value is a way to win, not
|
|
388
|
+
only bankrupting everyone else.
|
|
389
|
+
* **Trades bind on the verb alone.** Completion binding proves the model chose `propose_trade`,
|
|
390
|
+
not the specific deal, because re-rendering a nested structure differently would reject an
|
|
391
|
+
honest turn. The trade itself is still enforced by the engine's ordinary rules.
|
|
392
|
+
|
|
393
|
+
Everything else you would expect from the rulebook is implemented. Where the official text
|
|
394
|
+
depends on players acting simultaneously — the housing shortage — the trigger is written down
|
|
395
|
+
above rather than left to guess.
|
|
396
|
+
|
|
397
|
+
#### Housing shortage: a contested house goes to auction
|
|
398
|
+
|
|
399
|
+
There are only **32 houses and 12 hotels**. Officially, when the bank is short and two or more
|
|
400
|
+
players want more than it has, the pieces are sold at auction — which is what makes buying up
|
|
401
|
+
the supply to deny opponents a real tactic rather than a myth.
|
|
402
|
+
|
|
403
|
+
A build becomes **contested** when the bank still has at least one of the needed piece **and
|
|
404
|
+
more seats could legally buy that piece right now than the bank has to sell**. "Could legally
|
|
405
|
+
buy" is the rules' own test — owns the full unmortgaged colour group, the square is at the group
|
|
406
|
+
minimum, can afford the price — not a guess about intent. Five houses left and two eligible
|
|
407
|
+
builders is not contested; one house left and two eligible builders is.
|
|
408
|
+
|
|
409
|
+
When it fires:
|
|
410
|
+
|
|
411
|
+
* Your `build` opens an auction instead of placing the house, and you are **already the high
|
|
412
|
+
bidder at list price**. Triggering it can never cost you anything: if nobody outbids you, you
|
|
413
|
+
buy at exactly the price you would have paid anyway.
|
|
414
|
+
* Only seats that could legally place the piece may bid.
|
|
415
|
+
* **Your bid must name the square** you would build on (`property` alongside `amount`), and it
|
|
416
|
+
is validated when you bid. The auction sells the *piece*, so the winner still has to put it
|
|
417
|
+
somewhere legal — and choosing for you would pick the wrong colour group whenever you hold two.
|
|
418
|
+
* `mortgage` is available to fund a bid; `sell_house` is **not**, because returning pieces to
|
|
419
|
+
the bank mid-contest would change the very supply being fought over.
|
|
420
|
+
* Watch for `house_auction_started`, which is distinct from `auction_started` — the latter sells
|
|
421
|
+
a property.
|
|
422
|
+
|
|
423
|
+
With **no** houses left there is no auction: officially you wait for pieces to come back to the
|
|
424
|
+
bank, and `build` is simply not legal.
|
|
425
|
+
|
|
426
|
+
#### You may raise cash during an auction
|
|
427
|
+
|
|
428
|
+
A bid is capped at the cash in your hand, and officially a bidder may **sell houses and
|
|
429
|
+
mortgage** to fund one. Both are legal while an auction is open, and using them does **not**
|
|
430
|
+
pass the bidding turn — you raised the money in order to bid, so the floor stays with you until
|
|
431
|
+
you actually `bid` or `pass`.
|
|
432
|
+
|
|
433
|
+
Only the cash-raising verbs are offered there. `build` and `unmortgage` spend money, so they
|
|
434
|
+
cannot fund a bid. That also makes the sequence monotonic — each property mortgages once, each
|
|
435
|
+
house sells once — so it is bounded by the board and needs no artificial limit.
|
|
436
|
+
|
|
437
|
+
#### You may manage property between other players' turns
|
|
438
|
+
|
|
439
|
+
The official rules let you buy houses, sell them back, mortgage and unmortgage **on your turn
|
|
440
|
+
or between other players' turns** — not only when it is your own turn. The window at the top of
|
|
441
|
+
each turn is where you do it, and the same verbs are legal there as in your own manage phase.
|
|
442
|
+
|
|
443
|
+
Building there does **not** cost you the floor: you can put up a whole street and only hand
|
|
444
|
+
back with `skip_trade` (or by proposing a trade). There is a per-window allowance so a looping
|
|
445
|
+
policy cannot stall the match.
|
|
446
|
+
|
|
447
|
+
Why this matters: it is what makes the timing plays possible — putting houses up just before an
|
|
448
|
+
opponent's roll, or buying the bank's last houses to deny a rival the same.
|
|
449
|
+
|
|
450
|
+
#### If you cannot pay, you may TRADE your way out
|
|
451
|
+
|
|
452
|
+
\* In `resolve_debt` you may `sell_house`, `mortgage`, **or `propose_trade`**, and declare
|
|
453
|
+
`bankrupt` only when none of those is enough. Selling a property to another player for the cash
|
|
454
|
+
to survive a rent is a legal and often correct move. A trade that brings in enough settles the
|
|
455
|
+
debt the moment it completes, exactly as selling a house would.
|
|
456
|
+
|
|
457
|
+
`unmortgage` is deliberately absent there — it costs money, and that phase exists because you
|
|
458
|
+
have none.
|
|
459
|
+
|
|
460
|
+
#### Legal actions are now exact
|
|
461
|
+
|
|
462
|
+
`legal_actions` in the management phases lists only what the engine will actually accept: no
|
|
463
|
+
`build` without a full, unmortgaged colour group, the cash, and a house in the bank; no
|
|
464
|
+
`mortgage` with buildings still standing in the group; no `unmortgage` you cannot afford. If a
|
|
465
|
+
verb is listed, it will not be refused as illegal. Choose only from that list.
|
|
285
466
|
|
|
286
467
|
### Events
|
|
287
468
|
|