-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (30 loc) · 1.25 KB
/
main.py
File metadata and controls
35 lines (30 loc) · 1.25 KB
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
import printBoard
import makeMove
import saveChessboard
import gameData
gameData = gameData.GameData([
['♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜'],
['♟', '♟', '♟', '♟', '♟', '♟', '♟', '♟'],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
['♙', '♙', '♙', '♙', '♙', '♙', '♙', '♙'],
['♖', '♘', '♗', '♕', '♔', '♗', '♘', '♖'],
], "white", [[True, True, True], [True, True, True]], False)
# set of variables contains game data that continually changes
# variable holds whose turn it is
# asks user if they want to load the saved JSON file, and sets the chessboard and current turn to it if so
saveData = saveChessboard.loadChessBoard()
if saveData:
gameData.chessboard = saveData[0]
gameData.currentTurn = saveData[1]
gameData.castlingStates = saveData[2]
gameData.lastDouble = saveData[3]
# prints the board and starting player
printBoard.printChessBoard(gameData.chessboard)
print(gameData.currentTurn + "'s turn")
gameRunning = True
# loop for a turn being processed, till game ends
while gameRunning:
gameRunning = makeMove.makeMove(gameData)