divy-07 / chess-engine

Implementing a basic Java chess engine
Apache License 2.0
1 stars 0 forks source link

Changes to move format conversion #20

Open divy-07 opened 1 year ago

divy-07 commented 1 year ago

How we parse moves and make moves currently is very isolated, this can be made drastically simpler and integrated into the main architecture.

Currently, when we get the position command from UCI, we get "position [fen/startpos] [moves]" we do:

  1. parse the given fen or "startpos" to make a new Position object
  2. apply moves one by one using MoveConversion.applyAlgebraMoves(), which returns a Position object after moves were applied
  3. this position is stored in the engine field

What would be better is:

  1. same as step 1 above
  2. convert all the given moves into Move objects (implement Move.fromAlgebraicNotation())
  3. Use Position.makeMove() to update the position

This approach moves away from using static isolated methods, designed only for this task and uses more general and tested methods.