Components

GameData dataclass

Class representing the game data. It's main use would be for strategizing or simulating plies.

Attributes:
  • rounds_played (int) –

    The number of rounds played. Defaults to 0.

  • miscommunications (Sequence[int]) –

    The miscommunication counts for each team. Defaults to [0, 0].

  • interceptions (Sequence[int]) –

    The interception counts for each team. Defaults to [0, 0].

Source code in /home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@dataclasses.dataclass(kw_only=True)
class GameData:
    """Class representing the game data. It's main use would be for strategizing or simulating plies.

    Attributes:
        rounds_played (int, optional): The number of rounds played. Defaults to 0.
        miscommunications (Sequence[int], optional): The miscommunication counts for each team. Defaults to [0, 0].
        interceptions (Sequence[int], optional): The interception counts for each team. Defaults to [0, 0].
    """
    rounds_played: int = 0
    miscommunications: Sequence[int] = dataclasses.field(default_factory=lambda: [0, 0])
    interceptions: Sequence[int] = dataclasses.field(default_factory=lambda: [0, 0])

    def copy(self):
        """Create a deep copy of the GameData object.

        Returns:
            GameData: A deep copy of the GameData object.
        """
        return deepcopy(self)

copy()

Create a deep copy of the GameData object.

Returns:
  • GameData

    A deep copy of the GameData object.

/home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
49
50
51
52
53
54
55
def copy(self):
    """Create a deep copy of the GameData object.

    Returns:
        GameData: A deep copy of the GameData object.
    """
    return deepcopy(self)

Note dataclass

Class representing a note with information about the code, clues, attempted decipher and interception of a team in a given round.

Attributes:
  • clues (Clue) –

    The clue information associated with the note.

  • attempted_interception (Code) –

    The code for the attempted interception.

  • attempted_decipher (Code) –

    The code for the attempted decipher.

  • correct_code (Code) –

    The correct deciphered code.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@dataclasses.dataclass(kw_only=True)
class Note:
    """Class representing a note with information about the code, clues, attempted decipher and interception of a team in a given round.

    Attributes:
        clues (Clue): The clue information associated with the note.
        attempted_interception (Code): The code for the attempted interception.
        attempted_decipher (Code): The code for the attempted decipher.
        correct_code (Code): The correct deciphered code.
    """
    clues: Clue
    attempted_interception: Code
    attempted_decipher: Code
    correct_code: Code

TeamName

Bases: IntEnum

Enumeration representing the team names.

Attributes:
  • WHITE (int) –

    Team name for the White team, with a value of 0.

  • BLACK (int) –

    Team name for the Black team, with a value of 1.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class TeamName(IntEnum):
    """Enumeration representing the team names.

    Attributes:
        WHITE (int): Team name for the White team, with a value of 0.
        BLACK (int): Team name for the Black team, with a value of 1.
    """
    WHITE = 0
    BLACK = 1

    def __repr__(self):
        """Custom representation for TeamName enumeration values.

        Returns:
            str: A formatted string representation of the TeamName.
        """
        return f"<{self.name}: {self.value}>"

    def __str__(self):
        """Custom string method for TeamName enumeration values.

        Returns:
            str: The name of the team.
        """
        return str(self.name)

__repr__()

Custom representation for TeamName enumeration values.

Returns:
  • str

    A formatted string representation of the TeamName.

/home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
20
21
22
23
24
25
26
def __repr__(self):
    """Custom representation for TeamName enumeration values.

    Returns:
        str: A formatted string representation of the TeamName.
    """
    return f"<{self.name}: {self.value}>"

__str__()

Custom string method for TeamName enumeration values.

Returns:
  • str

    The name of the team.

/home/docs/checkouts/readthedocs.org/user_builds/decryptogame/envs/latest/lib/python3.10/site-packages/decryptogame/components.py
28
29
30
31
32
33
34
def __str__(self):
    """Custom string method for TeamName enumeration values.

    Returns:
        str: The name of the team.
    """
    return str(self.name)