Module encode

Module encode 

Source
Expand description

Structs§

ActionFamilySpec
Action family specification.
ActionIdDesc
Human-readable description of an action id.
ActionParam
Named parameter for an action id description.
ActionSpec
Full action specification.
ObsFieldSpec
Single observation field specification.
ObsSliceSpec
Slice specification for contiguous observation segments.
ObservationSpec
Full observation specification.
PlayerBlockSpec
Per-player observation block specification.

Enums§

ActionParamValue
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.