olufjen / chess

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

Game strategies from week 39 #34

Open olufjen opened 3 years ago

olufjen commented 3 years ago

18.11.21: These issues are now solved. 05.11.21: For Bishop/Queen and Rook: only the closest friendly occupied position must be set to friendly.

The game system contains two knowledgebases: One parent KB and a Strategy KB. The strategy KB contains knowledge about possible movements from available posistions: occupies(WhiteRook2,g1) REACHABLE(WhiteRook2_g1,h1) REACHABLE(WhiteRook2_g1,f1) occupies(WhiteRook2,f1) REACHABLE(WhiteRook2_f1,h1) REACHABLE(WhiteRook2_f1,g1)

We have a class Performance that is responsible for calculating the performance measure.

olufjen commented 3 years ago

In the parent knowledge base: Set PROTECTEDBY for all player and opponent pieces. REF: PROTECTEDBY(WhiteBishop1,d2) REACHABLE(WhiteBishop1,d2) Position b2 is not there !! Solved 01.11.21 03.11.21: This must be solved: This is caused by the makerules method !!! occupies(BlackQueen,d8) OWNER(BlackPlayer,BlackQueen) BOARD(d8) PLAYER(BlackPlayer) PIECETYPE(BlackQueen,QUEEN) PROTECTEDBY(BlackQueen,d1) REACHABLE(BlackQueen,d1) PROTECTEDBY(BlackQueen,d3) REACHABLE(BlackQueen,d3) PROTECTEDBY(BlackQueen,d4) REACHABLE(BlackQueen,d4) PROTECTEDBY(BlackQueen,e8) REACHABLE(BlackQueen,e8) PROTECTEDBY(BlackQueen,d7) REACHABLE(BlackQueen,d7) PROTECTEDBY(BlackQueen,e7) REACHABLE(BlackQueen,e7) Only d7 and d6 should be here!! This is a consequence of position is only friendly for white !!! Check chessAction line 411 !!!

This is done in the chess agent object. Must also check the removed position routine!

Must find which positions a piece possibly can reach (and protect) from av given position (one ply down) A new defined predicate: POSSIBLYPROTECTEDBY(piece, pos). An example: POSSIBLYPROTECTEDBY(Whitequeen_c2,h7)

olufjen commented 3 years ago

This is solved 05.10.21: The queen creates reachable positions in two steps. After castling, the white queen loses the northwest and northeast positions.!!!!??? The northeast and northwest positions are "removed" from the queen available list

olufjen commented 2 years ago

SOLVED 21.10.21: Opponent removed positions for queen's castle positions and castle opponent removed.

olufjen commented 2 years ago

Solved 21.10.21: Piece Piece position b3 X, Y (1, 2) wQ d1 QUEEN ActiveName Q

Check the CheckOpponentremove method:

CheckOpponentremove The min position: d5 Color W Direction NE sumdif 4 Piece no.chess.web.model.ChessPiece Ontology name BlackPawn5 Chesspiece position d5 Piece active: true true gamepiece null

CheckOpponentremove: f7 Color W Direction NE sumdif 8 Piece no.chess.web.model.ChessPiece Ontology name BlackPawn6 Chesspiece position f7 Piece active: true true gamepiece null added to remove list CheckOpponentremove: g8 Color W Direction NE sumdif 10 Piece no.chess.web.model.ChessPiece Ontology name BlackKing Chesspiece position g8 Piece active: true true gamepiece null added to remove list CheckOpponentremove: c4 Color W Direction NE sumdif 2 Piece None false gamepiece Gamenone added to remove list CheckOpponentremove: e6 Color W Direction NE sumdif 6 Piece None false gamepiece Gamenone added to remove list

olufjen commented 2 years ago

Files B43 and Q32 are missing. Must use the sumDif number from the removed position in the same direction.

olufjen commented 2 years ago

a2 should have been available and removed: piece: Piece position b3 X, Y (1, 2) wQ d1 QUEEN ActiveName Q Available positions Position: h3 W X, Y (7, 2) Position: g3 B X, Y (6, 2) Position: f3 W X, Y (5, 2) Occupied by: WhiteKnight2 Position: e3 B X, Y (4, 2) Occupied by: WhitePawn5 Position: d3 W X, Y (3, 2) Occupied by: WhiteBishop2 Position: b1 W X, Y (1, 0) Position: c3 B X, Y (2, 2) Occupied by: WhiteKnight1 Position: b2 B X, Y (1, 1) Occupied by: WhitePawn2 Position: b4 B X, Y (1, 3) Position: a3 B X, Y (0, 2) Position: b5 W X, Y (1, 4) Position: b6 B X, Y (1, 5) Position: b7 W X, Y (1, 6) Occupied by: BlackPawn2 Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: c4 W X, Y (2, 3) Position: d5 W X, Y (3, 4) Occupied by: BlackPawn5 Position: e6 W X, Y (4, 5) Position: f7 W X, Y (5, 6) Occupied by: BlackPawn6 Position: g8 W X, Y (6, 7) Occupied by: BlackKing Position: d1 W X, Y (3, 0) Occupied by: WhiteQueen Position: c2 W X, Y (2, 1) Removed positions Position: f3 W X, Y (5, 2) Occupied by: WhiteKnight2 Position: e3 B X, Y (4, 2) Occupied by: WhitePawn5 Position: d3 W X, Y (3, 2) Occupied by: WhiteBishop2 Position: c3 B X, Y (2, 2) Occupied by: WhiteKnight1 Position: b2 B X, Y (1, 1) Occupied by: WhitePawn2 Position: h3 W X, Y (7, 2) Position: g3 B X, Y (6, 2) Position: b1 W X, Y (1, 0) Position: b8 B X, Y (1, 7) Occupied by: BlackKnight1 Position: f7 W X, Y (5, 6) Occupied by: BlackPawn6 Position: g8 W X, Y (6, 7) Occupied by: BlackKing Position: e6 W X, Y (4, 5)