olufjen / chess

Programs to utilize chess ontologies, and play games of chess
1 stars 0 forks source link

Chess castling #18

Open olufjen opened 3 years ago

olufjen commented 3 years ago

We need a method to perform chess castling When all position to the left or right of the King then the king and the rook can exchange places. A suggested procedure: The moved piece is checked for castling. If that is the case then the method returns which castle is involved

31.03.21: For further work see issue Deferred action 12.05.21: Castling works for the white players.

olufjen commented 3 years ago

My first castling: castling.PNG

The available positions are not changed: Piece position f8 X, Y (5, 7) bR f8 ROOK ActiveName R Available positions Position: h1 W X, Y (7, 0) Position: h2 B X, Y (7, 1) Occupied by: WhitePawn8 Position: h3 W X, Y (7, 2) Position: h4 B X, Y (7, 3) Position: h5 W X, Y (7, 4) Position: h6 B X, Y (7, 5) Position: h7 W X, Y (7, 6) Occupied by: BlackPawn8 Position: g8 W X, Y (6, 7) Occupied by: BlackKing Position: f8 B X, Y (5, 7) Occupied by: BlackRook2 Position: e8 W X, Y (4, 7) Position: d8 B X, Y (3, 7) Occupied by: BlackQueen Position: c8 W X, Y (2, 7) Occupied by: BlackBishop1 Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: a8 W X, Y (0, 7) Occupied by: BlackRook1 Removed positions Position: h7 W X, Y (7, 6) Occupied by: BlackPawn8 Position: g8 W X, Y (6, 7) Occupied by: BlackKing Position: d8 B X, Y (3, 7) Occupied by: BlackQueen Position: c8 W X, Y (2, 7) Occupied by: BlackBishop1 Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: a8 W X, Y (0, 7) Occupied by: BlackRook1

olufjen commented 3 years ago

The current castling move: The white player makes two moves !!! and the black Rook occupies wrong position

castling2.PNG

Piece name BlackRook2 rnbq1rk1/ppp11ppp/111bpn11/1N1P1111/111P1111/11111N11/PP11PPPP/R1BQKB1R Piece position f8 X, Y (5, 7) bR f8 ROOK ActiveName R Available positions Position: g1 B X, Y (6, 0) Position: g2 W X, Y (6, 1) Occupied by: WhitePawn7 Position: g3 B X, Y (6, 2) Position: g4 W X, Y (6, 3) Position: g5 B X, Y (6, 4) Position: g6 W X, Y (6, 5) Position: h8 B X, Y (7, 7) Position: g7 B X, Y (6, 6) Occupied by: BlackPawn7 Position: f8 B X, Y (5, 7) Occupied by: BlackRook2 Position: e8 W X, Y (4, 7) Position: d8 B X, Y (3, 7) Occupied by: BlackQueen Position: c8 W X, Y (2, 7) Occupied by: BlackBishop1 Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: a8 W X, Y (0, 7) Occupied by: BlackRook1 Removed positions Position: g7 B X, Y (6, 6) Occupied by: BlackPawn7 Position: d8 B X, Y (3, 7) Occupied by: BlackQueen Position: c8 W X, Y (2, 7) Occupied by: BlackBishop1 Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: a8 W X, Y (0, 7) Occupied by: BlackRook1

Does not calculate correct removed positions. (see above list)

olufjen commented 3 years ago

Queen moved from b3 to h3:

castling260321.PNG

olufjen commented 3 years ago

For further work see issue Deferred action