Exemplo n.º 1
0
def __coord_in_target(piece: Piece) -> Tuple[int, int]:
    """Draw in target positions: each piece has its location.
    Progress is always same, thus irrelevant
    
    >>> __coord_in_target(Piece(0, 0, 62))
    (7, 6)

    >>> __coord_in_target(Piece(1, 1, 62))
    (6, 11)

    >>> __coord_in_target(Piece(2, 2, 62))
    (11, 11)

    >>> __coord_in_target(Piece(3, 3, 62))
    (12, 8)
    """
    assert piece.progress() == 62

    zones = [(7, 6), (6, 10), (10, 11), (11, 7)]
    shift = [(0, 0), (0, 1), (1, 0), (1, 1)]

    return (
        zones[piece.player()][0] + shift[piece.index()][0],
        zones[piece.player()][1] + shift[piece.index()][1],
    )
Exemplo n.º 2
0
def __coord_in_home(piece: Piece) -> Tuple[int, int]:
    """Draw in home positions: each piece has its location. Progress is always same, thus irrelevant
    
    >>> __coord_in_home(Piece(0, 0))
    (5, 2)

    >>> __coord_in_home(Piece(1, 1))
    (2, 13)

    >>> __coord_in_home(Piece(2, 2))
    (13, 15)

    >>> __coord_in_home(Piece(3, 3))
    (16, 6)
    """
    assert piece.progress() == 0

    zones = [(5, 2), (2, 12), (12, 15), (15, 5)]
    shift = [(0, 0), (0, 1), (1, 0), (1, 1)]

    return (
        zones[piece.player()][0] + shift[piece.index()][0],
        zones[piece.player()][1] + shift[piece.index()][1],
    )