Encoding Plan
from dgisim import EncodingPlan
EncodingPlan is a class defining how to encode a game.
- class EncodingPlan(mode_mapping: dict[type['Mode'], int], card_mapping: dict[type['Card'], int], char_mapping: dict[type['Character'], int], effect_mapping: dict[type['Effect'], int], status_mapping: dict[type['Status'], int], summon_mapping: dict[type['Summon'], int], support_mapping: dict[type['Support'], int], cards_fixed_len: int = 40, status_fixed_len: int = 7, statuses_fixed_len: int = 10, char_hidden_fixed_len: int = 4, char_stt_fixed_len: int = 13, player_hidden_fixed_len: int = 10, player_combat_fixed_len: int = 10, summons_fixed_len: int = 4, supports_fixed_len: int = 4, effect_fixed_len: int = 25, effects_fixed_len: int = 40)
This is the class for GameState encoding planning. It contains information on the codes for each type of item.
- __init__(mode_mapping: dict[type['Mode'], int], card_mapping: dict[type['Card'], int], char_mapping: dict[type['Character'], int], effect_mapping: dict[type['Effect'], int], status_mapping: dict[type['Status'], int], summon_mapping: dict[type['Summon'], int], support_mapping: dict[type['Support'], int], cards_fixed_len: int = 40, status_fixed_len: int = 7, statuses_fixed_len: int = 10, char_hidden_fixed_len: int = 4, char_stt_fixed_len: int = 13, player_hidden_fixed_len: int = 10, player_combat_fixed_len: int = 10, summons_fixed_len: int = 4, supports_fixed_len: int = 4, effect_fixed_len: int = 25, effects_fixed_len: int = 40) None
- Parameters:
mode_mapping – a mapping from mode to code.
card_mapping – a mapping from card to code.
char_mapping – a mapping from character to code.
effect_mapping – a mapping from effect to code.
status_mapping – a mapping from status to code.
summon_mapping – a mapping from summon to code.
support_mapping – a mapping from support to code.
cards_fixed_len – the fixed length of any encoded cards vector.
status_fixed_len – the default fixed length of encoded status vector.
statuses_fixed_len – the default fixed length of encoded statuses vector.
char_hidden_fixed_len – the default fixed length of encoded character hidden statuses vector.
char_stt_fixed_len – the default fixed length of encoded character statuses vector.
player_hidden_fixed_len – the default fixed length of encoded player hidden statuses vector.
player_combat_fixed_len – the default fixed length of encoded player combat statuses vector.
summons_fixed_len – the default fixed length of encoded summons vector.
supports_fixed_len – the default fixed length of encoded supports vector.
effect_fixed_len – the default fixed length of encoded effect vector.
effects_fixed_len – the default fixed length of encoded effects vector.
- code_for(item: Card | Character | Effect | Mode | Status | Summon | Support | type['Card'] | type['Character'] | type['Effect'] | type['Mode'] | type['Status'] | type['Summon'] | type['Support']) int
- Returns:
the code for the given item.