-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path'
More file actions
35 lines (28 loc) · 1.01 KB
/
Copy path'
File metadata and controls
35 lines (28 loc) · 1.01 KB
1
2
3
4
5
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
33
34
35
from typing import Set
from .coords import Coords
from .hex_type import HexType
class Hex:
"""A hex on a Catan board
Args:
coords (Coords): The coordinates of this hex
hex_type (HexType): The type of this hex
token_number (int, optional): The number of the token on this hex, or None if the hext is a desert
Attributes:
CONNECTED_POINTS_OFFSETS (Set[Coords]):
The offsets of the connected points from a hex's coordinates
coords (Coords): The coordinates of this hex
hex_type (HexType): The type of this hex
token_number (int): The number of the token on this hex
"""
CONNECTED_CORNER_OFFSETS: Set[Coords] = {
Coords(1, 0),
Coords(0, 1),
Coords(-1, 1),
Coords(-1, 0),
Coords(0, -1),
Coords(1, -1),
}
def __init__(self, coords: Coords, hex_type: HexType, token_number: int = None):
self.coords = coords
self.hex_type = hex_type
self.token_number = token_number