diff options
| author | Mario Lang <mlang@delysid.org> | 2014-03-28 11:57:29 +0100 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2014-03-28 12:14:19 +0100 |
| commit | 6ece68a4a2f5a413f48bb6816b25a41a9376ee3e (patch) | |
| tree | 2ac7ebe01ee50b451ee2e308e1454d5a539a2b86 /chess-uci.el | |
| parent | 866b08a1f0c41c54fe398730ed7d3a0e77f400db (diff) | |
Make the strength of book replies configurable.
Diffstat (limited to 'chess-uci.el')
| -rw-r--r-- | chess-uci.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/chess-uci.el b/chess-uci.el index ad6852c..e164f72 100644 --- a/chess-uci.el +++ b/chess-uci.el @@ -36,7 +36,16 @@ (defcustom chess-uci-polyglot-book-file nil "The path to a polyglot binary opening book file." :group 'chess-uci - :type '(choice (const :tag "Not specified" nil) file)) + :type '(choice (const :tag "Not specified" nil) (file :must-match t))) + +(defcustom chess-uci-polyglot-book-strength 1.0 + "Influence random distribution when picking a ply from the book. +A value above 1.0 means to prefer known good moves while a value below +1.0 means to penalize known good moves. 0.0 will stop to consider +move weights and simply pick a move at random. For simple +reasons of numerical overflow, this should be strictly less than 4.0." + :group 'chess-uci + :type '(float :match (lambda (widget value) (and (>= value 0) (< value 4))))) (defvar chess-uci-book nil "A (polyglot) opening book object. @@ -121,8 +130,10 @@ If conversion fails, this function fired an 'illegal event." (let ((book-ply (and chess-uci-book (bufferp chess-uci-book) (buffer-live-p chess-uci-book) - (chess-polyglot-book-ply chess-uci-book - (chess-game-pos game))))) + (chess-polyglot-book-ply + chess-uci-book + (chess-game-pos game) + chess-uci-polyglot-book-strength)))) (if book-ply (let ((chess-display-handling-event nil)) (funcall chess-engine-response-handler 'move book-ply)) |
