02-10-2021, 07:27 PM
Chapter 19 of the Ludii Language Reference contains some information on AI-related metadata that can be entered in the metadata section of your .lud description, and some AIs can then make use of that metadata. Alpha-Beta is probably the easiest AI to improve through manually-specified metadata; more specifically, it will use any heuristics specified in the metadata (see Section 19.3).
For Ludii's built-in games, we generally move AI metadata out of the .lud files because it can get a bit ugly and verbose, and into separate .def files which can be found in /def_ai/. For custom games outside the JAR, Ludii wouldn't be able to find where such external files are, but you can still just write the metadata directly inside the .lud file as you would for any other metadata. For instance, the metadata for chess would look something like this (excluding everything except for the AI metadata):
The (bestAgent "Alpha-Beta") thing lets Ludii know that for this particular game, Alpha-Beta is the best algorithm we currently have available, and this is then the algorithm that is automatically selected if you choose for "Ludii AI". The rest are heuristics; in this case just some very simple weights for different piece types.
Aside from heuristics, it is also possible to add geometric patterns / "features" in the metadata, which can then be used by the Biased MCTS algorithm, but working manually with those (as opposed to automatically training them) is probably quite a bit more complicated.
For Ludii's built-in games, we generally move AI metadata out of the .lud files because it can get a bit ugly and verbose, and into separate .def files which can be found in /def_ai/. For custom games outside the JAR, Ludii wouldn't be able to find where such external files are, but you can still just write the metadata directly inside the .lud file as you would for any other metadata. For instance, the metadata for chess would look something like this (excluding everything except for the AI metadata):
Code:
(metadata
(ai
(bestAgent "Alpha-Beta")
(heuristics {
(material transformation:(divNumInitPlacement) pieceWeights:{
(pair "Pawn1" 1.0)
(pair "Pawn2" 1.0)
(pair "Rook1" 5.0)
(pair "Rook2" 5.0)
(pair "Bishop1" 3.0)
(pair "Bishop2" 3.0)
(pair "Knight1" 3.0)
(pair "Knight2" 3.0)
(pair "Queen1" 9.0)
(pair "Queen2" 9.0)
})
})
)
)
The (bestAgent "Alpha-Beta") thing lets Ludii know that for this particular game, Alpha-Beta is the best algorithm we currently have available, and this is then the algorithm that is automatically selected if you choose for "Ludii AI". The rest are heuristics; in this case just some very simple weights for different piece types.
Aside from heuristics, it is also possible to add geometric patterns / "features" in the metadata, which can then be used by the Biased MCTS algorithm, but working manually with those (as opposed to automatically training them) is probably quite a bit more complicated.