This subsystem contains the determination of a next move starting from a game position. The position is given from outside. The engine itself is stateful and always plays one game at the same time. The default implementation needs an implementation of the game rules to work. An opening library, however, is optional.
The Engine subsystem provides its functionality via the Java interface
org.dokchess.engine.Engine.
Default implementation is the class
org.dokchess.engine.DefaultEngine.
Fig.: Interface Engine and class DefaultEngine
Method | Short description |
---|---|
setupPieces | Sets the state of the engine to the specified position. If currently a move calculation is running, this will be cancelled. |
determineYourMove | Starts the determination of a move for the current game situation. Returns move candidates asynchronously via an Observable (→ 6.1 Runtime View “Move Determination Walkthrough”). The engine does not perform the moves. |
performMove | Performs the move given, which changes the state of the engine. If currently a move calculation is running, this will be canceled. |
close | Closes the engine. The method makes it possible to free resources. No move calculations are allowed afterwards. |
Table: Methods of the Engine interface |
Method | Short description |
---|---|
DefaultEngine | Constructors, set an implementation of the chess rules, → Subsystem Rules (Black Box) and an (optional) opening book, whose moves will be preferred to own considerations, → Subsystem Opening (Black Box). |
Table: Methods of the DefaultEngine class (in addition to the Engine interface) |
→ Concept 8.2 Chess Domain Model (“Chess domain model”) describes the types used in the interface as call and return parameters (Move, Position). Refer to the source code documentation (javadoc) for more information.
You find details of the Engine subsystem implementation in the white box view in section 5.6 of this overview.
The implementation of the Engine subsystem and corresponding unit tests are located below the packages
org.dokchess.engine…