Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game strategies from week 40 22 #50

Open
olufjen opened this issue Oct 4, 2022 · 8 comments
Open

Game strategies from week 40 22 #50

olufjen opened this issue Oct 4, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@olufjen
Copy link
Owner

olufjen commented Oct 4, 2022

We can use a Percept schema as a description of a move the opponent makes.
Define and implement the following chess strategies:

  1. Material count: The total piece value for each player. This is a variable held in the player object.
  2. Piece activity: How active are my pieces? Count the number of moves each piece has made.
  3. Pawn structure: Are any of my pawns isolated? Can I isolate opponent pawns?
  4. Space: The number squares the player has behind his own pawns where his pieces can move
  5. King safety.
@olufjen olufjen added the enhancement New feature or request label Oct 4, 2022
@olufjen
Copy link
Owner Author

olufjen commented Oct 17, 2022

Fixed 18.1022
The following message is a bug:
The following piece is available as protector for position e4: WhitePawn5 and is at e2
Produced in the Aperfomance object

@olufjen
Copy link
Owner Author

olufjen commented Oct 22, 2022

When the opponent king can be taken, then a warning must be given, and moves must be backtracked.

@olufjen
Copy link
Owner Author

olufjen commented Oct 24, 2022

When opponent castling is performed only this move is shown:
Piece BlackKingFrom position e8 Color W Direction NONE sumdif 2 Piece None false Friendly false gamepiece Gamenone
To position g8 Color W Direction NONE sumdif 4 Piece no.chess.web.model.ChessPiece Ontology name BlackKing
Chesspiece position g8
Move number 12 o-oCreation Created with from and to position

When player performs castling, these moves are recorded:
Piece WhiteKingFrom position e1 Color B Direction NONE sumdif 4 Piece None false Friendly false gamepiece Gamenone
To position g1 Color B Direction NONE sumdif 6 Piece no.chess.web.model.ChessPiece Ontology name WhiteKing
Chesspiece position g1
Piece active: true true Friendly false gamepiece null
Move number 15 o-oCreation Created with from and to position
Move
Piece WhiteRook2From position h1 Color W Direction NONE sumdif 7 Piece None false Friendly false gamepiece Gamenone
To position f1 Color W Direction NONE sumdif 5 Piece no.chess.web.model.ChessPiece Ontology name WhiteRook2
Chesspiece position f1
Piece active: true true Friendly false gamepiece null
Move number 16 o-oxCreation Created with from and to position
Piece active: true true Friendly false gamepiece null
The move number must not be increased.

@olufjen
Copy link
Owner Author

olufjen commented Oct 24, 2022

Check the chooseStrategy method:
Here we must find which opponent pieces are at these reachable positions OLJ 24.10.22:

Checking reachable for key WhiteKnight1_e4c5 from occupied position e4 can then reach position c5
For pawns, we need to calculate new attack positions from these new possible positions.

@olufjen
Copy link
Owner Author

olufjen commented Dec 20, 2022

From a game 21.12.22:
game211222.PNG

Moving black bishop to f5 produces this error:
Caused by: java.lang.NullPointerException
at no.chess.web.model.PlayGame.proposeMove(PlayGame.java:311)
No move is selected! The ProblemSolver returns with no Problem to solve.
https://app.zenhub.com/files/137453363/85016b24-aac2-47be-8773-b51a7203e5e0/download

The next game:
Player makes no move:
https://app.zenhub.com/files/137453363/a4fcc669-ff81-40b0-bf40-e2b02b1d6322/download
Chosen action Schema
Action(WhiteKnight2_d4)
PRECOND:^PROTECTEDBY(WhiteQueen,d4)^PROTECTEDBY(WhitePawn5,d4)^occupies(WhiteKnight2,f3)^REACHABLE(WhiteKnight2,d4)^PIECETYPE(WhiteKnight2,KNIGHT)
EFFECT:^occupies(WhiteKnight2,d4)^PIECETYPE(WhiteKnight2,KNIGHT)
The new position and the preferred position
d4
d4
This move cannot be made. The d4 position is occupied by a friendly piece.
Knights have not removed positions of friendly pieces !! See ChessProblemSolver - checkopponentThreat

24.12.22 Added removed positions for knight.
This is the resulting game.
https://app.zenhub.com/files/137453363/9600869b-2067-4400-9324-edf3bacd5dd2/download

@olufjen
Copy link
Owner Author

olufjen commented Dec 25, 2022

How to make a strategy out of this?
Pick out:
WhiteQueen Can threaten the king from c4 or:
The piece can take the king from h7 and move is possible? false
The following piece is available as protector for position h7: WhiteBishop2 and is at d3

See also game:
https://app.zenhub.com/files/137453363/a18a1f8d-e34a-4f92-b0ae-0fe3ebcfc0b1/download

Investigating for piece WhiteQueen at a6 with type QUEEN and position to move to a5
The piece can take the king from g1 and move is possible? false
The piece can take the king from g2 and move is possible? false
The piece can take the king from g3 and move is possible? false
The piece can take the king from g4 and move is possible? false
The piece can take the king from g5 and move is possible? false
The following piece is available as protector for position g5: WhiteKnight2 and is at f3
The piece can take the king from g6 and move is possible? false
The following piece is available as protector for position g6: WhiteBishop2 and is at d3
The piece can take the king from h8 and move is possible? false
The piece can take the king from g7 and move is possible? false
The piece can take the king from f8 and move is possible? false
The piece can take the king from e8 and move is possible? false
The piece can take the king from d8 and move is possible? false
The piece can take the king from c8 and move is possible? false
The following piece is available as protector for position c8: WhiteQueen and is at a6
WhiteQueen Can threaten the king from c8
The piece can take the king from b8 and move is possible? false
The piece can take the king from a8 and move is possible? false
The piece can take the king from f7 and move is possible? false
The piece can take the king from e6 and move is possible? false
The piece can take the king from d5 and move is possible? false
The piece can take the king from c4 and move is possible? false
The following piece is available as protector for position c4: WhiteBishop2 and is at d3
The following piece is available as protector for position c4: WhiteQueen and is at a6
WhiteQueen Can threaten the king from c4
The piece can take the king from b3 and move is possible? false
The piece can take the king from a2 and move is possible? false
The piece can take the king from h7 and move is possible? false
The following piece is available as protector for position h7: WhiteBishop2 and is at d3

@olufjen
Copy link
Owner Author

olufjen commented Mar 20, 2023

When moving to take pawn at d5:
Caused by: java.lang.NullPointerException
at no.games.chess.planning.ChessLevel.(ChessLevel.java:39)
at no.games.chess.planning.ChessGraph.addLevel(ChessGraph.java:51)
at no.games.chess.planning.ChessGraphPlanAlgorithm.expandGraph(ChessGraphPlanAlgorithm.java:218)
at no.games.chess.planning.ChessGraphPlanAlgorithm.graphPlan(ChessGraphPlanAlgorithm.java:75)
at no.chess.web.model.game.AChessProblemSolver.planProblem(AChessProblemSolver.java:1324)

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 a6
10 Nxd5 Nxd5
11 Qxd5 Be6
12 Qe4 f5
13 Qxe6 Rf7
14 Qxf7 Kxf7
15 Bc4 Kf8
16 Be2 -

@olufjen
Copy link
Owner Author

olufjen commented Mar 24, 2023

Opponent King is also a protector. See the above game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant