olufjen / chess

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

Game strategies from week 2 22 #40

Open olufjen opened 2 years ago

olufjen commented 2 years ago

After opening moves, we must find "interesting positions". EXAMPLE 1: Move Whiteknight1 to d5. d5 is interesting because the knight can take the blackKnight2 at f6. d5 is a "from" position in the strategy KB: A position key WhiteKnight1_d5f6. d5 is not reachable from the parent KB. I.E: We must find a move that can protect d5. This we can find in the strategy KB. EXAMPLE 2: WhiteKnight1 to b5. b5 is interesting because it can take BlackBishop2 at d6. b5 is not threatened by the opponent. EXAMPLE 3: WhiteKnite1 to e4 is NOT interesting, because e4 is threatened by a black pawn.

olufjen commented 2 years ago

An example: Checking position key: WhiteKnight1_d5f6 Piece WhiteKnight1 From position d5 A found key BlackKnight2 at f6 Must find which piece can reach this position f6 - the to position:

f6 Reachable from strategy knowledge base termNames - reachablePieces f6 Threats from parent knowledge base threatNames - tothreatPieces f6 Reachable from parent knowledge base reachparentNames - toreachablePieces f6 Pawn attack from parent knowledge base pawnThreats - topawnthreatPieces

The from position Reachable from strategy knowledge base fromtermNames - fromreachablePieces The from position Threats from parent knowledge base fromthreatNames -fromthreatparentPieces The from position Reachable from parent knowledge base fromreachparentNames - fromreachparentPieces The from position Pawn attack from parent knowledge base frompawnThreats - frompawnparentPieces

The from position d5 Reachable from strategy knowledge base WhiteQueen_b3 - reachablePieces The from position Threats from parent knowledge base BlackKnight2 -fromthreatparentPieces BlackPawn5 The from position Reachable from parent knowledge base WhiteKnight1 - fromreachparentPieces BlackKnight2 The from position Pawn attack from parent knowledge base BlackPawn5 - frompawnparentPieces

olufjen commented 2 years ago

The from position d5 investigated protectorPieces: Piece WhiteBishop2 is protector of d5 from c4 Piece WhiteBishop2 is protector of d5 from e4 Piece WhiteQueen is protector of d5 from b3 needprotectionPieces: Piece WhiteKnight1 with value 3 must have a protection for d5 These pieces threatens the piece (at the from position): BlackKnight2

We have a number of from positions in the Map: fromreachablePieces. Choose a "from" position. Is there any threat to this position? If no, then choose this piece for this position. If yes and the position is not protected, then find a piece that can protect this position from the reachablePieces Map.

olufjen commented 2 years ago

The bugs in the following comments have been fixed: (07.02.22)

game010222

The latest moves: 1 d4 d5 2 c4 Nf6 3 Nc3 e6 4 Nf3 Bd6 5 cxd5 exd5 6 e3 o-o 7 Bd3 h6 8 o-o Nc6 9 Qb3 Be6 10 Be2 a6 11 b4 -

olufjen commented 2 years ago

game_v2010222

Moves: 1 d4 d5 2 c4 Nf6 3 Nc3 e6 4 Nf3 Bd6 5 cxd5 exd5 6 e3 o-o 7 Bd3 h6 8 o-o Nc6 9 Qb3 Be6 10 Be2 a6 11 Qxb7 Bd7 12 Qxf7 -

olufjen commented 2 years ago

From the moves shown, the queen has the following available and removed positions: The d7 position is not removed!! From position b7 Color W Direction NONE sumdif 2 Piece no.chess.web.model.ChessPiece Ontology name WhiteQueen Chesspiece position b7 Piece active: true true Friendly false gamepiece null

To position a8 Color W Direction NONE sumdif 2 Piece no.chess.web.model.ChessPiece Ontology name BlackRook1 Chesspiece position a8 Piece active: true true Friendly false gamepiece null Move number 0 Creation Created from gamepiece preferred position piece: Piece position b7 X, Y (1, 6) wQ b7 QUEEN ActiveName Q Available positions Position: h7 W X, Y (7, 6) Position: b1 W X, Y (1, 0) Position: g7 B X, Y (6, 6) Occupied by: BlackPawn7 Position: b2 B X, Y (1, 1) Occupied by: WhitePawn2 Position: f7 W X, Y (5, 6) Occupied by: BlackPawn6 Position: b3 W X, Y (1, 2) Position: e7 B X, Y (4, 6) Position: b4 B X, Y (1, 3) Position: d7 W X, Y (3, 6) Occupied by: BlackBishop1 Position: b5 W X, Y (1, 4) Position: c7 B X, Y (2, 6) Occupied by: BlackPawn3 Position: b6 B X, Y (1, 5) Position: b8 B X, Y (1, 7) Position: a7 B X, Y (0, 6) Position: h1 W X, Y (7, 0) Position: g2 W X, Y (6, 1) Occupied by: WhitePawn7 Position: f3 W X, Y (5, 2) Occupied by: WhiteKnight2 Position: e4 W X, Y (4, 3) Position: d5 W X, Y (3, 4) Occupied by: BlackPawn5 Position: c6 W X, Y (2, 5) Occupied by: BlackKnight1 Position: c8 W X, Y (2, 7) Position: a6 W X, Y (0, 5) Occupied by: BlackPawn1 Position: a8 W X, Y (0, 7) Occupied by: BlackRook1 Removed positions Position: b2 B X, Y (1, 1) Occupied by: WhitePawn2 Position: g2 W X, Y (6, 1) Occupied by: WhitePawn7 Position: f3 W X, Y (5, 2) Occupied by: WhiteKnight2 Position: h1 W X, Y (7, 0) Position: b1 W X, Y (1, 0) Position: d5 W X, Y (3, 4) Occupied by: BlackPawn5 Position: e4 W X, Y (4, 3) Position: h7 W X, Y (7, 6) Position: g7 B X, Y (6, 6) Occupied by: BlackPawn7 Position: f7 W X, Y (5, 6) Occupied by: BlackPawn6 Position: e7 B X, Y (4, 6)