Set to true
to override other options and run an optimised negamax function.
Overrides:
true
true
Invalidates:
Method used to search for best move. See SearchMethod for details
Timeout used when method is TIME. Timeout disabled when set to 0.
Default search depth for depth and deepening searches.
Depth to start from for deepening and time based. Bypassing early depths may improve performance.
Use the child generator instead of creating all children for each node. Should be faster and use less memory.
Method used to sort nodes if presort is enabled
Alpha
nodeMaximum number of nodes allowed in the tree. Search will finish if exceeded, returning NODE_LIMIT.
Actual nodes in tree will be between nodeLimit and nodeLimit + x where x, is the number of moves/children being checked when the nodeLimit is exceeded.
Disabled by setting to 0
Only works with Negamax (optimal = false)
Experimental
randomExperimental
randomFor removing nodes in between iterative searches. Allows for deeper searches that would otherwise be memory limited.
Good for reduced memory usage but takes extra time.
Controls the way removal behaves for DEPTH
Controls the way removal behaves for COUNT
Generated using TypeDoc
Options to configure the behaviour of the negamax search.
opts
property of Negamax.Recommended usage
Set the optimal flag to
true
for fast searching, effective pruning and reduced memory usage. Then use the method property along with the corresponding depth or timeout properties accordingly.Advanced usage
Search tuning
Set the optimal flag to
false
and try different combinations of pruning, presort, sortMethod and genBased to achieve the desired performance.Initial Depth
Setting initialDepth > 1 could potentially speed up searches.
Prune by path length
The pruneByPathLength flag enables fast wins and slow losses. When choosing between 2 nodes with the same value, if the value is positive, it will favour one that is fewer moves away (or is a leaf node). If the value is negative, the one that is more moves away. The opposite holds if the parent is a minimising node.
Does not work with optimal set to
true
.Node removal
The removalMethod option allows for trimming nodes that aren't needed from the game tree in between successive searches in DEEPENING and TIME modes. This can greatly reduce memory usage and allow for far deeper searches, but with more computation required.
There are 3 options:
Random selections
These options can be useful for making the AI less 'robotic'. Neither of them work with pruneByPathLength or optimal set to
true
. The randomWeight option does not work with pruning set to ALPHA_BETA. They will run but likely give incorrect results.The randomBest option will randomly select from the child nodes that all have the best value.
The randomWeight option selects from all the children, but is weighted towards the best valued. The weighting effect is outlined in the property documentation.