Skip to content

camp

Camp #

Class representing the camp selected before the game starts.

Source code in cogip/tools/planner/camp.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Camp(metaclass=Singleton):
    """
    Class representing the camp selected before the game starts.
    """

    class Colors(IntEnum):
        blue = 0
        yellow = 1

    def __init__(self, color: Colors = Colors.yellow):
        self.color = color

    def adapt_y(self, dist: float) -> float:
        """
        Adapt Y distance depending on the selected camp.
        Given the current table orientation and axes,
        only Y has to be adapted when the camp changes.
        """
        return dist if self.color == Camp.Colors.yellow else -dist

    def adapt_angle(self, angle: float | None) -> float | None:
        """
        Adapt an angle depending on the actual camp.
        """
        if angle is None:
            return None
        return angle if self.color == Camp.Colors.yellow else -angle

adapt_angle(angle) #

Adapt an angle depending on the actual camp.

Source code in cogip/tools/planner/camp.py
26
27
28
29
30
31
32
def adapt_angle(self, angle: float | None) -> float | None:
    """
    Adapt an angle depending on the actual camp.
    """
    if angle is None:
        return None
    return angle if self.color == Camp.Colors.yellow else -angle

adapt_y(dist) #

Adapt Y distance depending on the selected camp. Given the current table orientation and axes, only Y has to be adapted when the camp changes.

Source code in cogip/tools/planner/camp.py
18
19
20
21
22
23
24
def adapt_y(self, dist: float) -> float:
    """
    Adapt Y distance depending on the selected camp.
    Given the current table orientation and axes,
    only Y has to be adapted when the camp changes.
    """
    return dist if self.color == Camp.Colors.yellow else -dist