Created attachment 136 [details] When you try to castle, King disappears, and Rook moves to King's position Steps to reproduce: Make the following moves: 1. e4 e5 2. Nc3 nf6 3. d4 d5 4. Be4 bd6 5. Qd3 Qd6 6. O-O-O On the last move, when we try to do Queen's side castle, on the GUI the King disappears, and the Rook occupies the King's place. Expected results: ABCDEFGH 0 R BNR 1 PPP PPP 2 NQ 3 PPB 4 bpp 5 q n 6 ppp ppp 7 rnb rk Actual results: But on the console shows that the king and didn't move. ABCDEFGH 0 R BNR 1 PPP PPP 2 NQ 3 PPB 4 bpp 5 q n 6 ppp ppp 7 rnb k r
Reason: GUI class stores its own chess board in a linked lits, separate from the Game class' chess board. Castle move is identified as invalid by Game class, but GUI class still updates anyway. Game status in the GUI and Game are not synchronized. Resolution: Modify GUI logic to copy the chess board stored in Game to GUI everytime there is an update. This ensures GUI and Game chess boards are synchronized. https://github.com/glennsalter/cs3343-chess/commit/0ccccfc9879166374c4d3d944ed0f25981f58d7c
Resolution: Implement checking for castle by deep copying the board, and checking if a move results in a valid castle instead of moving the pieces in the current board, which will triger rook/ king to update its already moved status. https://github.com/glennsalter/cs3343-chess/commit/83331989258063560bb3c97f31e81ac5bdc2aee1