-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
76 lines (62 loc) · 1.47 KB
/
constants.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from enum import Enum
TITLE = "Sea Battle"
VERSION = "0.8.0"
AUTHOR = "Aunmag"
DESCRIPTION = (
f"{TITLE} (battleship) - my first text-based game, which I'd started to develop at "
"February 2016. While I have been learning GUI, I decided to make this test project "
"to practice coding. After some time I came back to finish and correct some "
"defects."
"\n\n"
"Notice that you may not arrange your ships manually. In the begging you can only "
"shuffle their position randomly."
)
OFFSETS = (-1, 0, 1)
ITERATION_LIMIT = 256 # Used to avoid infinite loops
class Color(object):
GRAY = "\033[2m"
RED = "\033[31;1;4m"
YELLOW = "\033[33;1;4m"
GREEN = "\033[32;1;4m"
BLUE = "\033[34;1;4m"
DEFAULT = "\033[0m"
class Cell(Enum):
SHIP_UNIT = 0
SHIP_DAMAGED = 1
SHIP_DESTROYED = 2
SPACE_EMPTY = 3
SPACE_HIT = 4
STYLE = {
Cell.SHIP_UNIT: (
"U",
Color.BLUE,
),
Cell.SHIP_DAMAGED: (
"W",
Color.RED,
),
Cell.SHIP_DESTROYED: (
"x",
Color.GRAY,
),
Cell.SPACE_EMPTY: (
".",
Color.GRAY,
),
Cell.SPACE_HIT: (
"*",
Color.GRAY,
),
}
class AxisDirection(Enum):
UNKNOWN = 0
X = 1
Y = 2
class HitStatus(Enum):
UNKNOWN = 0
MISS = 1
MISS_REPEATED = 2
DAMAGED = 3
DESTROYED = 4
class Console(Enum):
WRONG_INPUT = 0