-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
96 lines (79 loc) · 1.65 KB
/
config.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import math
from itertools import product
BLACK = ( 0, 0, 0)
FPSCLOCK=None
DISPLAYSURF=None
BASICFONT=None
SIM_NAME = 'Predator Prey'
SIM_TURNS=5000
FPS = 1000
WINDOWWIDTH = 900
WINDOWHEIGHT = 900
CELLSIZE = 30
RADIUS = math.floor(CELLSIZE/2.5)
assert WINDOWWIDTH % CELLSIZE == 0, "Window width must be a multiple of cell size."
assert WINDOWHEIGHT % CELLSIZE == 0, "Window height must be a multiple of cell size."
CELLWIDTH = int(WINDOWWIDTH / CELLSIZE)
CELLHEIGHT = int(WINDOWHEIGHT / CELLSIZE)
MESSAGE_LENGTH = 1 # Known as l in the paper
N_RANGE = 4
BEARINGS = {
'N': "000",
'NE': "001",
'E': "010",
'SE': "011",
'S': "100",
'SW': "101",
'W': "110",
'NW': "111",
}
N_BEARING = len(BEARINGS)
DIRECTION_STRS = [
"00",
"01",
"10",
"11",
]
MSG_STRS = ["".join(p) for p in product(["0", "1"], repeat=MESSAGE_LENGTH)]
DIST_STRS = [
"00",
"01",
"10",
"11",
]
BEARING_STRS = [
"000",
"001",
"010",
"011",
"100",
"101",
"110",
"111",
]
MESSAGE_BOARD_STR = [
"0000",
"0001",
"0010",
"0011",
"0100",
"0101",
"0110",
"0111",
"1000",
"1001",
"1010",
"1011",
"1100",
"1101",
"1110",
"1111",
]
ALL_POSSIBLE_STRINGS = set()
for a, b, c, d, e in product(DIRECTION_STRS, MSG_STRS, DIST_STRS, BEARING_STRS, MESSAGE_BOARD_STR):
ALL_POSSIBLE_STRINGS.add(a+b+c+d+e)
print(len(ALL_POSSIBLE_STRINGS))
# print((2 + MESSAGE_LENGTH) * N_RANGE * N_BEARING * 2**(MESSAGE_LENGTH * 4))
CHROMOSOME_LEN = len(ALL_POSSIBLE_STRINGS)
INPUT_MAP = {s: i for i, s in enumerate(ALL_POSSIBLE_STRINGS)}
BGCOLOR = BLACK