This repository has been archived by the owner on Jul 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.py
60 lines (57 loc) · 1.76 KB
/
core.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from enum import Enum, unique
@unique
class TileType(Enum):
FLOOR = 1
WALL = 2
DOOR = 3
FLOOR_WITH_OBJECT = 4
WALL_WITH_OBJECT = 5
@unique
class TileDecoration(Enum):
CLEAN = 1
OVERGROWN = 2
CRACKED = 3
PUDDLE = 4
WATER = 5
class DungeonTile:
def __init__(self):
self.tileType = TileType.FLOOR
self.tileDecoration = TileDecoration.CLEAN
self.height = 0.0
self.display = " "
self.neighbors = {}
self.x = 0
self.y = 0
self.visited = False
self.width: int[2] = [1, 1]
def __init__(self, _tileType, _tileDecoration, _height, _x, _y, _width = [1, 1]):
self.tileType = _tileType
self.tileDecoration = _tileDecoration
self.height = _height
self.display = "##"
self.neighbors = {}
self.x = _x
self.y = _y
self.visited = False
self.width = _width
# the following code is for debugging purposes only
if _tileType == TileType.WALL:
if _tileDecoration == TileDecoration.CLEAN:
self.display = "[]"
elif _tileDecoration == TileDecoration.OVERGROWN:
self.display = "[?"
else:
self.display = "//"
elif _tileType == TileType.FLOOR:
if _tileDecoration == TileDecoration.CLEAN:
self.display = " "
elif _tileDecoration == TileDecoration.OVERGROWN:
self.display = " ?"
elif _tileDecoration == TileDecoration.CRACKED:
self.display = " /"
elif _tileDecoration == TileDecoration.PUDDLE:
self.display = "()"
else:
self.display = "~~"
else:
self.display = "::"