Skip to content

AI Settings

Ilya V. Portnov edited this page Oct 27, 2023 · 7 revisions

HCheckers allows for detailed tuning of AI parameters, so the user can not only select between "fast" and "strong" AI, but also configure different tendencies.

AI used by HCheckers is based on alpha-beta pruning, with some optimizations. The AI looks through the tree of possible moves for a certain depth by default. For some "interesting" branches of the tree (for example, for sequences of captures), it looks deeper. If there are too many possible moves at first level, AI can reduce the depth, to save time. If there are, on the contrary, too few possible moves, it can think deeper. If AI thinks it is loosing the game, it can optionally increase thinking depth.

All parameters defining "thinking depth" are configured in "half-steps". One step is one move of two players, and half-step is one move of one player.

AI settings are configured in the Settings dialog. Different sets of settings are stored as named presets. The user can select AI preset to play with in the "new game" dialog.

Screenshot_20220405_004301

AI preset editor under AI Presets tab of the Settings dialog consists of several tabs.

At the bottom of the dialog, there are Save... and Load... buttons, allowing to save AI preset configuration to JSON file, or load it from JSON file.

General tab

  • Title. The name of preset. Mandatory parameter.
  • Default depth (half-steps). Default depth of thinking.
  • Minimum depth. Depth of thinking which is applied when there are too many possible moves.
  • Forced mode depth. Additional depth to apply in "forced mode", i.e. when there is only one possible move, which is a capture, enforced by checkers rules. If after Default depth of half-steps AI sees that there is a single possible "forced" move, it continues to think for another forced mode depth half steps maximum (it stops if sequence of captures ends).
  • Static search mode threshold
  • Think better if situation seem bad. If checked, the AI will increase thinking depth for one step, if it thinks it is loosing the game.
  • `Few moves' mode bound. If the number of possible moves is less than the number specified here, the AI will increase thinking depth.
  • `Too many moves' mode bound. If the number of possible moves is greater than the number specified here, the AI will reduce thinking depth.
  • Use positional score. If checked, then to understand in whose favor is current situation on the board, AI will consider not only the number of pieces on the board, but also their positions. This increases AI strength a lot, as well as thinking time.
  • Continue thinking while there is time. If checked, AI will try to think deeper and deeper, within specified timeout.
  • Timeout (seconds). Maximum time for AI to think. This is available only when continue thinking while there is time is enabled.
  • Random opening depth. AI will consider first N moves in each game as opening, and within this opening, it will select not exactly best move, but instead it will randomly select one of M (specified in the next parameter) best moves. This random behaviour makes AI game less strong, but more "human" and "diverse".
  • Random opening options. Number of best moves, to select from in the opening. To disable random behaviour, set this to 1.
  • Accept draws. This defines how should the AI react if you offer it a draw. The available options are:
    • Always accept
    • Always decline
    • Accept if AI is loosing

Board evaluation tab

Parameters on this tab define coefficients, used by AI to decide, how much different aspects of current position affect on "board score", i.e. how important these aspects are.

Note that HCheckers AI calculates "board score" as two numbers: numeric score and positional score. Numeric score corresponds to the number of player's pieces that are present on board; each king is usually counted as several men (see "King" parameter below). Positional score describes how good the pieces are positioned on board. HCheckers compares positional scores of different positions only when numeric score is equal; i.e. if one player has 5 pieces and another has 3, HCheckers decides that the first player has advantage, and no matter how exactly the pieces are placed on board. And only if both players have equal number of pieces, then HCheckers looks whose pieces are better placed.

  • Mobility. Coefficient for player mobility, i.e. the number of moves possible for the player. I.e., this defines how important it is to have as many moves as possible.
  • Back row. Coefficient for having the home row (first horizontal for white) filled with your pieces - so the other player could not make a king.
  • Center. Coefficient for having your pieces near the center of the board.
  • Border. Coefficient for having your pieces at the left or right border of the board. Usually this coefficient is negative, because it is bad to have pieces at the border. But in some rules, like frisian, it may be not so bad.
  • Opposite side. Coefficient for having your pieces near opposite side of the board.
  • Backed. This defines how important it is to have your pieces backed (so that they could not be captured).
  • Asymetry. This defines how bad it is to have your pieces distributed asymetrically on the board (for example having much more pieces on the left half than on the right). Apart from other parameters, this usually should have negative value: zero means it is not important, -100 means it is very bad. +100 means it is actually good.
  • Pre-king. Coefficient for having pieces in one step from becoming kings.
  • King. Weight of king, compared to usual men. Usually this should be something like 3: this will define that AI will be ready to sacrifice 3 men for 1 king. For rules like turkish, where a king is super-mighty, you may want to set this to 5 or 7. Or, on the other side, you may want AI to not sacrifice any men for kings; then you should set 1 here.
  • King positional weight. Weight of the king, when it is considered as part of positional score. By default this is 0, because kings are already counted in numeric score. But if you set "King" parameter, for example, to 1, you may want to set something like 100 or 500 here, so that AI will prefer positions where he has kings, among all positions with equal number of pieces.
  • Attacked man. This defines how bad it is to have your man under attack (in one step from being captured).
  • Attacked king. This defines how bad it is to have your king under attack (in one step from being captured).

Extra options tab

This tab contains a text entry field. It can be used to define some AI parameters, which are supported by AI, but for some reason were not supported (yet) as separate parameters in the GUI. Parameters are defined in JSON format.

Clone this wiki locally