Expand description
Observation/action encodings and schema constants. Observation/action encoding and spec helpers.
Related docs:
Structs§
- Action
Family Spec - Action family specification.
- Action
IdDesc - Human-readable description of an action id.
- Action
Param - Named parameter for an action id description.
- Action
Spec - Full action specification.
- ObsField
Spec - Single observation field specification.
- ObsSlice
Spec - Slice specification for contiguous observation segments.
- Observation
Spec - Full observation specification.
- Player
Block Spec - Per-player observation block specification.
Enums§
- Action
Param Value - Parameter value for an action id description.
Constants§
- ACTION_
ENCODING_ VERSION - Action encoding version. Changelog: https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/encodings_changelog.md#action_encoding_version-1
- ACTION_
SPACE_ SIZE - Total action space size.
- ACTION_
SPACE_ WORDS - Number of u64 words required to represent the action mask.
- ACTOR_
NONE - Sentinel for missing actor.
- ATTACK_
BASE - Base action id for “attack” (slot and attack-type offsets).
- ATTACK_
COUNT - Number of attack actions.
- ATTACK_
SLOT_ COUNT - Number of attack slots encoded/considered (front row).
- CHOICE_
BASE - Base action id for “choice select” (index offset).
- CHOICE_
COUNT - Number of choice select actions per page.
- CHOICE_
NEXT_ ID - Action id for “next choice page”.
- CHOICE_
PREV_ ID - Action id for “previous choice page”.
- CLIMAX_
PLAY_ BASE - Base action id for “climax: play climax” (hand index offset).
- CLIMAX_
PLAY_ COUNT - Number of climax play actions.
- CLOCK_
HAND_ BASE - Base action id for “clock from hand” (hand index offset).
- CLOCK_
HAND_ COUNT - Number of clock-from-hand actions (one per possible hand index).
- CONCEDE_
ID - Action id for “concede”.
- DECISION_
KIND_ NONE - Sentinel for no decision.
- ENCORE_
DECLINE_ BASE - Base action id for “encore: decline” (slot offset).
- ENCORE_
DECLINE_ COUNT - Number of encore decline actions.
- ENCORE_
PAY_ BASE - Base action id for “encore: pay” (slot offset).
- ENCORE_
PAY_ COUNT - Number of encore pay actions.
- LEVEL_
UP_ BASE - Base action id for “level up” (index offset).
- LEVEL_
UP_ COUNT - Number of level-up actions.
- MAIN_
MOVE_ BASE - Base action id for “main: move” (from/to slot offsets).
- MAIN_
MOVE_ COUNT - Number of main move actions.
- MAIN_
PLAY_ CHAR_ BASE - Base action id for “main: play character” (hand index and slot offsets).
- MAIN_
PLAY_ CHAR_ COUNT - Number of main play character actions.
- MAIN_
PLAY_ EVENT_ BASE - Base action id for “main: play event” (hand index offset).
- MAIN_
PLAY_ EVENT_ COUNT - Number of main play event actions.
- MAX_
ABILITIES_ PER_ CARD - Maximum number of abilities encoded per card (padding beyond this is ignored).
- MAX_
DECK - Deck size per player.
- MAX_
HAND - Maximum hand size encoded in observations.
- MAX_
LEVEL - Maximum number of cards encoded in the level zone.
- MAX_
STAGE - Number of stage slots per player.
- MULLIGAN_
CONFIRM_ ID - Action id for “confirm mulligan”.
- MULLIGAN_
SELECT_ BASE - Base action id for “mulligan select” (hand index offset).
- MULLIGAN_
SELECT_ COUNT - Number of mulligan select actions (one per possible hand index).
- OBS_
CONTEXT_ BASE - Base index of the context slice.
- OBS_
CONTEXT_ CHOICE_ ACTIVE - Context bit/index: choice selection active.
- OBS_
CONTEXT_ ENCORE_ PENDING - Context bit/index: encore is pending.
- OBS_
CONTEXT_ LEN - Length of the “context” slice.
- OBS_
CONTEXT_ PRIORITY_ WINDOW - Context bit/index: priority window active.
- OBS_
CONTEXT_ STACK_ NONEMPTY - Context bit/index: stack is non-empty.
- OBS_
ENCODING_ VERSION - Observation encoding version. Changelog: https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/encodings_changelog.md#obs_encoding_version-2
- OBS_
HEADER_ LEN - Observation header length.
- OBS_LEN
- Total observation vector length.
- OBS_
REASON_ BASE - Base index of the observation reason slice.
- OBS_
REASON_ IN_ ATTACK - Reason bit/index: in attack phase.
- OBS_
REASON_ IN_ CLIMAX - Reason bit/index: in climax phase.
- OBS_
REASON_ IN_ COUNTER_ WINDOW - Reason bit/index: in counter window.
- OBS_
REASON_ IN_ MAIN - Reason bit/index: in main phase.
- OBS_
REASON_ LEN - Length of the per-observation “reason” slice.
- OBS_
REASON_ NO_ COLOR - Reason bit/index: missing color requirement.
- OBS_
REASON_ NO_ HAND - Reason bit/index: no cards in hand.
- OBS_
REASON_ NO_ STOCK - Reason bit/index: no stock available.
- OBS_
REASON_ NO_ TARGETS - Reason bit/index: no valid targets.
- OBS_
REVEAL_ BASE - Base index of the reveal history slice.
- OBS_
REVEAL_ LEN - Length of the “reveal history” slice.
- PASS_
ACTION_ ID - Action id for “pass”.
- PER_
PLAYER_ BLOCK_ LEN - Per-player observation block length.
- PER_
PLAYER_ CLIMAX_ TOP - Cards encoded from the climax zone top.
- PER_
PLAYER_ CLOCK_ TOP - Cards encoded from the clock zone top.
- PER_
PLAYER_ COUNTS - Number of scalar count slots per player block.
- PER_
PLAYER_ DECK - Cards encoded from the deck.
- PER_
PLAYER_ HAND - Cards encoded from the hand.
- PER_
PLAYER_ LEVEL - Cards encoded from the level zone.
- PER_
PLAYER_ RESOLUTION_ TOP - Cards encoded from the resolution top.
- PER_
PLAYER_ STAGE - Total per-player stage slice length.
- PER_
PLAYER_ STOCK_ TOP - Cards encoded from the stock top.
- PER_
PLAYER_ WAITING_ TOP - Cards encoded from the waiting room top.
- PER_
STAGE_ SLOT - Scalars encoded per stage slot.
- POLICY_
VERSION - Policy version used in spec hash composition.
- SPEC_
HASH - Combined encoding spec hash.
- TOP_
CLOCK - Number of top cards encoded from the clock zone.
- TOP_
RESOLUTION - Number of top cards encoded from the resolution zone.
- TOP_
STOCK - Number of top cards encoded from the stock zone.
- TOP_
WAITING_ ROOM - Number of top cards encoded from the waiting room zone.
- TRIGGER_
ORDER_ BASE - Base action id for “trigger order” (index offset).
- TRIGGER_
ORDER_ COUNT - Number of trigger-order actions.
Functions§
- action_
desc_ for_ id - Decode an action id into a canonical action descriptor.
- action_
id_ for - Encode a canonical action descriptor into an action id.
- action_
spec - Build the action specification.
- action_
spec_ json - Serialize the action specification as JSON.
- build_
action_ mask - Build a dense action mask and lookup table from a legal action list.
- decode_
action_ id - Decode an action id into a human-readable description.
- encode_
observation - Encode a full observation into a fixed-length buffer.
- fill_
action_ mask - Fill a dense action mask and lookup table from a legal action list.
- fill_
action_ mask_ sparse - Update sparse action mask buffers from a legal action list.
- observation_
spec - Build the observation specification.
- observation_
spec_ json - Serialize the observation specification as JSON.