-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtile.py
34 lines (24 loc) · 815 Bytes
/
tile.py
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
# Farben
import enum
from util.game_color import GameColor
class TileColor(enum.Enum):
PURPLE = GameColor(153, 102, 255)
YELLOW = GameColor(255, 215, 0)
PINK = GameColor(255, 182, 193)
GREEN = GameColor(84, 224, 168)
BLUE = GameColor(0, 191, 255)
class TileAddon(enum.Enum):
NONE = 0
FROZEN = 1 # Cannot be moved until combined two times
BOMB = 2 # Destroys all tiles around it
BLOCKER = 3 # Cannot be moved or destroyed
LOCKED = 4 # Cannot be moved
class Tile:
addon: TileAddon
def __init__(self, color: GameColor, addon: TileAddon = TileAddon.NONE):
self.color: GameColor = color
self.addon: TileAddon = addon
def can_combine(self):
return self.addon != TileAddon.BLOCKER
def can_be_moved(self):
return self.addon not in [TileAddon.BLOCKER, TileAddon.LOCKED, TileAddon.FROZEN]