-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.py
226 lines (203 loc) · 4.96 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
from panda3d.core import LPoint3
# EDIT GAMEMODE AT THE BOTTOM (CHESS VARIANTS)
# COLORS (for the squares)
BLACK = (0, 0, 0, 1)
WHITE = (1, 1, 1, 1)
HIGHLIGHT = (0, 1, 1, 1)
HIGHLIGHT_MOVE = (0, 1, 0, 1)
HIGHLIGHT_ATTACK = (1, 0, 0, 1)
# SCALE (for the 3D representation)
SCALE = 0.5
PIECE_SCALE = 0.3
BOARD_HEIGHT = 1.5
# MODELS
MODEL_PAWN = "models/pawn.obj"
MODEL_ROOK = "models/rook.obj"
MODEL_KNIGHT = "models/knight.obj"
MODEL_BISHOP = "models/bishop.obj"
MODEL_QUEEN = "models/queen.obj"
MODEL_KING = "models/king.obj"
MODEL_UNICORN = "models/unicorn.obj"
# MODEL TEXTURES
TEXTURE_WHITE = "models/light_wood.jpg"
TEXTURE_BLACK = "models/dark_wood.jpg"
# HELPER FUNCTIONS
def square_position(x, y, z, board_size):
# Gives the 3d position of a square based on x, y, z
xx, yy, zz = board_size
x = (x - (3.5/8)*xx) * SCALE
y = (y - (3.5/8)*yy) * SCALE
z = z*BOARD_HEIGHT * SCALE
return LPoint3(x, y, z)
def square_color(x, y, z):
# Checks whether a square should be black or white
if (x+y+z) % 2 == 0:
return BLACK
else:
return WHITE
# BOARDS
# 1 = Pawn
# 2 = Rook
# 3 = Knight
# 4 = Bishop
# 5 = Queen
# 6 = King
# 7 = Unicorn
# + = white
# - = black
# First array = lowest level
# Highest part of the array = front (white pieces)
PIECES = {
0: 'empty space',
-1: 'black pawn',
-2: 'black rook',
-3: 'black knight',
-4: 'black bishop',
-5: 'black queen',
-6: 'black king',
-7: 'black unicorn',
1: 'white pawn',
2: 'white rook',
3: 'white knight',
4: 'white bishop',
5: 'white queen',
6: 'white king',
7: 'white unicorn',
}
RAUMSCHACH_PAWN_2STEP = False
RAUMSCHACH_BOARD = [
[
[ 2, 3, 6, 3, 2],
[ 1, 1, 1, 1, 1],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
],
[
[ 4, 7, 5, 7, 4],
[ 1, 1, 1, 1, 1],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
],
[
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
],
[
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[-1,-1,-1,-1,-1],
[-4,-7,-5,-7,-4],
],
[
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[-1,-1,-1,-1,-1],
[-2,-3,-6,-3,-2],
],
]
SMALL_RAUMSCHACH_PAWN_2STEP = False
SMALL_RAUMSCHACH_BOARD = [
[
[ 2, 4, 6, 4, 2],
[ 3, 1, 1, 1, 3],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
],
[
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
],
[
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[-3,-1,-1,-1,-3],
[-2,-4,-6,-4,-2],
],
]
CARD_PAWN_2STEP = True
CARD_BOARD = [
[
[ 2, 5, 6, 2],
[ 1, 1, 1, 1],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
],
[
[ 4, 3, 3, 4],
[ 1, 1, 1, 1],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[-1,-1,-1,-1],
[-4,-3,-3,-4],
],
[
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[-1,-1,-1,-1],
[-2,-5,-6,-2],
],
]
CLASSIC_PAWN_2STEP = True
CLASSIC_BOARD = [
[
[ 2, 3, 4, 5, 6, 4, 3, 2],
[ 1, 1, 1, 1, 1, 1, 1, 1],
[ 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0],
[-1,-1,-1,-1,-1,-1,-1,-1],
[-2,-3,-4,-5,-6,-4,-3,-2],
],
]
# NOTE: PAWN_2STEP is whether the pawn can take 2 steps if it's on the second line (bool)
RAUMSCHACH = (RAUMSCHACH_BOARD, RAUMSCHACH_PAWN_2STEP)
SMALL_RAUMSCHACH = (SMALL_RAUMSCHACH_BOARD, SMALL_RAUMSCHACH_PAWN_2STEP)
CARD = (CARD_BOARD, CARD_PAWN_2STEP)
CLASSIC = (CLASSIC_BOARD, CLASSIC_PAWN_2STEP)
TEST_PAWN_2STEP = True
TEST_BOARD = [
[
[ 0, 1, 6, 0],
[ 0, 0, 0, 0],
[ 0, 0,-2,-2],
[ 0, 0, 0, 0],
],
[
[ 0, 1, 6, 0],
[ 0, 0, 0, 0],
[ 0, 0,-2,-2],
[ 0, 0, 0, 0],
],
]
TEST = (TEST_BOARD, TEST_PAWN_2STEP)
# Edit gamemode here
GAMEMODE = SMALL_RAUMSCHACH
# Edit players here
HUMANS = (1, )
AIS = (-1, )
BOARD, PAWN_2STEP = GAMEMODE
BOARD_SIZE = (len(BOARD[0][0]), len(BOARD[0]), len(BOARD))
TEST = True