Repository navigation
Battle simulator: rules checked against PTCG Live's engine and the official rulings - #357
Merged
Merged
Conversation
…he general Compendium rulings Timed effects wait for their turn; attack-damage steps apply to attacks only; Prize cards taken one at a time with a face-up choice (#809); retreat paid with up to the cost in cards (#2127); next player flips first in Checkup (#867); Stadium once-per-turn belongs to the card (#926); cards from public zones into the hand stay known (#787). 98 general rulings newly pinned (531 of 1,944). On-Behalf-Of: @cheyras Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKj6CMZ1kKCNaVjKSHgJpx
… nothing, legality notes for pasted lists A tie starts a sudden-death game (1 Prize card each, new coin flip) instead of a recorded draw, as the rulebook and PTCG Live's MatchMode.SuddenDeath do. A search of your own deck for a kind of card may find none (Compendium #903); a search for any card or a discard-pile pick keeps its minimum (#2301). Lists passed straight to simulate_battles get a note when they break the 4-copy, ACE SPEC or Basic Pokémon rules, and are still simulated. On-Behalf-Of: @cheyras Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKj6CMZ1kKCNaVjKSHgJpx
… protected Active, and the log replay fixed #668: a Special Energy that provides its type only while attached is no type off a Pokemon. #1823: a Trainer switching out a protected Active does nothing. An attack or Ability that switches in a Benched Pokemon no longer checks the Active's protection (ruling 2155; Heave-Ho Catcher vs Hide 'n' Sneak, found by replaying a real game). The PTCG Live log replay now completes all 36 real games (was 18): hidden-hand cards proven by detail lines, spread-attack targets, multi-coin flips, Judge draws, moved counters, codeless printings and more, each pinned by a synthetic log test. On-Behalf-Of: @cheyras Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKj6CMZ1kKCNaVjKSHgJpx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cheyras
added a commit
that referenced
this pull request
Oct 20, 2026
…d Tournament Rules (#359) This follows up #357. Everything that pass left on purpose was checked against the **Advanced Player's Rulebook v3.4 (2025)** and the **Play! Pokémon Tournament Rules Handbook**. The five items that break the rules now follow them. Decision: `decisions/2026/2026-10-19-battle-simulator-turn-timing-and-the-end-of-a-game-follow-the-advanced-player-s.md`. - **Tiebreaker game with 6 Prize cards**, won by the first player to have fewer Prize cards left (APR "Games can result in a tie"; Tournament Rules 5.8.3.1). This corrects #357's 1-Prize sudden death, which followed older wording. - **"During this turn / your next turn / your opponent's next turn" effects end before Pokémon Checkup**, because Checkup is in neither player's turn (APR E-02). "Until the end of your next turn" still applies in it (E-22, E-23). - **Knock Outs from end-of-turn effects are resolved before Checkup.** A Knock Out is checked whenever HP becomes zero (APR D), so Checkup healing can no longer save a Pokémon already at 0. - **Setup is face down.** Both players' Active and Bench choices stay hidden in hand and go into play together when the game starts (APR G, steps 5–8). - **The turn cap is time being called.** The turn is finished, 3 more are played, then the player with fewer Prize cards left wins (reason `time`). Level, play goes on until one player is ahead (Tournament Rules 5.8.3). Only a long stalemate stays a `turn limit` draw. Not changed, because they break no rule: the CPU choosing to go first, and Energy/damage-counter moves written per card. ## Verification - `@deckpal/sim`: 3,242 tests pass. New rule tests in `rules-timing` and `rules-checklist`; each new behavioural test fails with its fix disabled. - All 36 real PTCG Live games (26 of the owner's logs, which are not committed, plus the 10 fixtures) still replay to the end with matching winners. - Fuzz: 4,000 random games, 0 failures. The 90 former turn-limit draws now end by `time` (40) or a tiebreaker game (6). - `deckpal-api test:deck` 261, `@deckpal/agent-tools` 398, and `tsc --noEmit` across workspaces are clean. - `determinism.test.ts` re-pinned: 18 of 40 seeded games change, mostly because setup events are now ordered by the face-down reveal. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01MKj6CMZ1kKCNaVjKSHgJpx Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The battle simulator's rules engine, checked against PTCG Live's own match engine and the official rulings, and made to follow them.
PTCG Live's engine (
MatchLogic.dll, read with REA for type, enum and method names only) was used as a checklist of the mechanics the real game models. The rulebook, card text and the Rulings Compendium still decide behaviour. No PTCG Live code, data or text is in this PR, and ruling text stays on the Compendium. Full record:decisions/2026/2026-10-17-battle-simulator-the-core-rules-checked-against-ptcg-live-s-engine-and-the-gener.md.Engine
MatchMode.SuddenDeath), instead of a recorded draw.Tests and tools
rules-timing,rules-attack-damage,rules-checklist,rulings-general-*.src/replay/*, each pinned by a synthetic log inreplay-log-fixes.test.ts.simulate_battles: a pasted list that breaks the 4-copy, ACE SPEC or Basic Pokémon rules gets a note, and is still simulated.rules_lookup: a new "Effects that last a turn" entry, and Sudden Death replaces "draw" in the winning rules.Verification
@deckpal/sim: 3,231 tests pass.deckpal-api test:deck: 261 pass.@deckpal/agent-tools: 398 pass.tsc --noEmitis clean in every workspace.determinism.test.tsre-pinned: 14 of the 40 seeded games now play differently, from the retreat, Stadium, #787 and Checkup changes.Still open
🤖 Generated with Claude Code
https://claude.ai/code/session_01MKj6CMZ1kKCNaVjKSHgJpx