1+ import numpy as np
2+
3+
4+
5+ class gameBoard ():
6+ def __init__ (self ):
7+ #pieces notation white: 1 black:2
8+ #pawn: 1 Rook: 2 Knight: 3 Bishop: 4 Queen: 5 King: 6
9+ #0 = empty
10+ self .board = np .array ([[22 , 23 , 24 , 25 , 26 , 24 , 23 , 22 ],
11+ [21 , 21 , 21 , 21 , 21 , 21 , 21 , 21 ],
12+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
13+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
14+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
15+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
16+ [11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 ],
17+ [12 , 13 , 14 , 15 , 16 , 14 , 13 , 12 ]])
18+
19+ self .board3 = np .array ([[22 , 0 , 0 , 0 , 26 , 0 , 0 , 22 ],
20+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
21+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
22+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
23+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
24+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
25+ [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
26+ [0 , 0 , 0 , 0 , 16 , 0 , 0 , 0 ]])
27+
28+ self .WhitesTurn = True
29+ self .MoveLog = np .array ([])
30+ #self.MoveLog = []
31+ self .whiteKingPosition = (7 , 4 )
32+ self .blackKingPosition = (0 , 4 )
33+ self .checkmate = False
34+ self .stalemate = False
35+ self .inCheck = False
36+ self .pins = []
37+ self .checks = [] #pieces which put the king in check
38+ self .currentCastleRights = CastleRights (True , True , True , True )
39+ #annotation bqs: Black queen side bks: black king side wqs: white queen side wks: white king side
40+ #stores the castle rights for undoing a move
41+ self .CastleRightsLog = [CastleRights (self .currentCastleRights .bqs , self .currentCastleRights .bks ,
42+ self .currentCastleRights .wqs , self .currentCastleRights .wks )]
43+
44+
45+
46+ #class for storing the castle rights
47+ class CastleRights ():
48+ def __init__ (self , bqs , bks , wqs , wks ):
49+ self .wks = wks
50+ self .bks = bks
51+ self .wqs = wqs
52+ self .bqs = bqs
0 commit comments