olufjen / chess

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

Game strategies from week 30 22 #49

Open olufjen opened 1 year ago

olufjen commented 1 year ago

When creating an Action Schema can we change Constant piece = new Constant(pieceName); Constant pos = new Constant(posName); Constant toPos = new Constant(toPosit); List variables = new ArrayList(Arrays.asList(piece,pos,toPos)); to : Variable piece = new Variable("piece"); Variable frompos = new Variable("from"); Variable topos = new Variable("to"); List variables = new ArrayList(Arrays.asList(piece,pos,toPos)); and then: ActionSchema movedAction = new ActionSchema(actionName,variables,precondition,effects); But then the preconditions and effects must also contain the same Variables. This would represent one general Action Schema for all Action Schemas represented in the Problem

17.08.22: These points have been done. The castling move needs to be reworked. Create a new Action schema based on the castling move. (King to g1, Castle to f1, King to c1 Castle to d1)

olufjen commented 1 year ago

An action schema is applicable in a state s if the preconditions are satisfied by s. An action a can be executed in state s if s entails the precondition of a. (p. 368) (Also read p. 375.) The initial state (state s) may contain more fluents than the precondition. The initial state may only contain ground atoms ( no variables or functions).

olufjen commented 1 year ago

04.08.22:This problem has now been fixed: A game 02.08.22: The CASTLE predicate must be declared in the precondition!! 1 d4 d5 2 c4 Nf6 3 Nc3 e6 4 Nf3 Bd6 5 cxd5 exd5 6 e3 o-o 7 Bd3 h6 8 Bd2 game020822.PNG

The bishop is moved instead of king The fluents of end outcome contains in addition to init state: occupies(WhiteKing,e2) PIECETYPE(WhiteKing,KING) occupies(WhiteKing,f1) PIECETYPE(WhiteKing,KING) occupies(WhiteKing,d2) PIECETYPE(WhiteKing,KING) occupies(WhiteKing,e2) PIECETYPE(WhiteKing,KING) occupies(WhiteKing,e2) PIECETYPE(WhiteKing,KING) The fluents of goal state:

The game after the bug fix: 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 Nxd5 Nxd5 11 Qxb7 Bd7 12 Qa6 -

olufjen commented 1 year ago

27.08.22 Solved 27.08.22 Caused by: java.lang.NullPointerException at no.chess.web.model.game.AChessProblemSolver.prepareAction(AChessProblemSolver.java:747) at no.chess.web.model.game.AChessProblemSolver.checkMovenumber(AChessProblemSolver.java:1011) at no.chess.web.model.game.AChessProblemSolver.planProblem(AChessProblemSolver.java:1125) at no.chess.web.model.game.AChessAgent.execute(AChessAgent.java:469) at no.chess.web.model.PlayGame.proposeMove(PlayGame.java:305) 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 b6 10 Nxd5 Nxd5 11 Qxd5 Be6 12 Qb5 a6 13 Qxc6 f5 14 Bc2

olufjen commented 1 year ago

Corrected!! Action(WhitePawn5_d4) PRECOND:^occupies(WhitePawn5,e3)^REACHABLE(WhitePawn5,d4)^PIECETYPE(WhitePawn5,PAWN) EFFECT:^occupies(WhitePawn5,d4)^PIECETYPE(WhitePawn5,PAWN) The above action schema must be changed to PAWNATTACK(WhitePawn5,d4)

olufjen commented 1 year ago

At this stage of the game: The opponent King is checked!! 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 Rf6 - An illegal move !! 14 Qd5 -

check.PNG