Yinsh
The Engine
To allow the integration of multiple agents with different behaviour, a YINSH engine was created in JAVA. Different AI modules can be imported into the engine, after which the user can choose which AI he wants to play against, or which AI's he wants to play vs each other.
The engine provides the following functions:
- Game Virtualisation: a virtual yinsh game can be played after two players have been selected to play the game. The players are notified on different events, for example when a turn needs to be played or when a ring was won by the opponent. Because the engine provides the player with a lot of information during these events, integrating a new AI is very simple. For example, when a turn needs to be played, the engine will provide the player with all valid moves. Also, the game keeps track of its own history therefore making it possible to reconstruct games or to detect specific behaviour.
- AI plugins: When a new AI needs to be developed, it only requires the creation of a class that catches the events triggered by the game engine. It is important that this AI provides valid output (eg moves), but since the engine always provide all possible valid outputs, implementing a new AI is only a matter of smart selection.
- Move Simulation: to allow the use of different game search techniques, a simulation engine was created where a move on the game board could be simulated to find out how that would affect the environment one move ahead. Since there are often more possible effects for only one move (eg row/ring removal choice), a list of these effects are stored and returned, so techniques like A* become very simple to implement.
- Game Tree Search: for easening the implementation of new AI's, a tree search engine has been written which calculates the game upto a certain depth. Different techniques have been implemented to enhance the performance of this search: alpha beta pruning, heuristic evaluations, efficient memory handling, ... Also, a multithreaded version is available next to the singlethreaded one.
- AI Heuristics Training: all AI's can be which use a heuristic calculator, can be trained by an evolution algorithm, also present in the engine. This evolution algorithm is completely dynamic (it has no limits on the amount of parameters) and is highly configurable.
- AI Performance Statistics: all AI's can be evaluated using the game simulation module. Extended statistics like win densities and progresses can be produced and stored to the harddisk.
- Logging: all important and less important events are logged. Therefore it is possible to find out errors, or to simply keep track of the different games. When a new AI is implemented, the main logger can be used since it is shared by the whole engine. This allows the centralization of all the logs together, yet making a distinction between the origin. Moreover, levels can be assigned to different logging messages, making it possible to filter them afterwards. There are information messages, error messages, fatal messages, ...
- Configuration: A lot of effort was put in keeping the engine tweakable. This means the gui's will provide a lot of parameters which can be changed. Also, a lot of parameters can be changed in a configuration file in the root directory of the project.
The main concept of this engine is to provide other people a helpful interface
which allows them to play YINSH and to generate new computer players, without
having to think of all the game rules and some technical implementations.
The creators of this engine are me (Thomas Debray) and Kalle Fischer.