;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312\313\314&\210\315\316\317\320\321DD\322\323\324%\207" [require chess-common chess-fen chess-pgn chess-var custom-declare-group chess-crafty nil "The publically available chess engine 'crafty'." :group chess-engine :link (custom-manual "(chess)Crafty") custom-declare-variable chess-crafty-path funcall function #[0 "\300\301!\206 \300\302!\207" [executable-find "crafty" "wcrafty"] 2] "The path to the crafty executable." :type file] 8) (defvar chess-crafty-evaluation nil) (make-variable-buffer-local 'chess-crafty-evaluation) #@50 Non-nil if Crafty is currently in analysis mode. (defvar chess-crafty-analyzing-p nil (#$ . 705)) (make-variable-buffer-local 'chess-crafty-analyzing-p) (defvar chess-crafty-regexp-alist (byte-code "\301\302Q\303B\304\305B\306\307B\310\311B\312\313\314\260\315B\316\317B\320\321B\322\323B\324\325B\257 \207" [chess-algebraic-regexp "move\\s-+\\(" "\\)\\s-*$" #[0 "\301\302\303!\304\305\306\307!#\206\310\307\311\"\266\202\"\207" [chess-engine-response-handler move match-string 1 t chess-algebraic-to-ply chess-engine-position nil chess-engine-command illegal] 8] "total evaluation\\.+\\s-+\\([-+0-9.]+\\)" #[0 "\301\302\303!!\211\207" [chess-crafty-evaluation string-to-number match-string 1] 3] "tellicsnoalias kibitz Hello from\\s-+\\(.+\\)$" #[0 "\301\302!\211\207" [chess-engine-opponent-name match-string 1] 2] "Analyze Mode: type \"exit\" to terminate.$" #[0 "\301\211\207" [chess-crafty-analyzing-p t] 2] " ?\\([0-9]+\\)\\s-+\\(-?[0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\(\\( *[1-9][0-9]*\\. \\(\\.\\.\\.\\|" "\\)\\( " "\\)?\\)+\\)$" #[0 "\205\301\303\304\305!!\303\304\306!!\307\310!\311\312#\210\311\313#\210\311\314\214\315\224\315\225}\210\211\206- \211\316!\2058\211G\317U\262\204E\320\321\322\323E\"\210\211C\262C\262eb\210m\204\272\324\325!\203`\326\225b\210\202\263\324\n!\203\263\326\225b\210\327\310\204u\330\331!\210\332\"\211\211:\205\215\211@\316!\205\213\211G\317U\262\262\204\232\320\321\333\334E\"\210\211@\266\203\335\326!\"\211\204\255\336\337\335\326!\"\210\340\"\266\341\310w\210\202O\211\262)#\266\203\207" [chess-crafty-analyzing-p chess-starting-position chess-algebraic-regexp read match-string 1 2 chess-engine-position nil chess-pos-set-epd acd ce pv 5 vectorp 75 signal wrong-type-argument chess-pos position looking-at "[1-9][0-9]*\\.[ .]*" 0 chess-algebraic-to-ply cl--assertion-failed var chess-var-ply chess-ply ply match-string-no-properties error "unable to read move '%s'" chess-var-move " "] 16] "analyze complete.$" #[0 "\301\211\207" [chess-crafty-analyzing-p nil] 2] "{\\(Black\\|White\\) resigns}" #[0 "\301!\207" [chess-engine-response-handler resign] 2] "\\(Illegal move\\|unrecognized/illegal command\\):\\s-*\\(.*\\)" #[0 "\300\301\302!!\207" [error match-string 1] 3] "command not legal now" #[0 "\300\301\302!!\207" [error match-string 0] 3]] 10)) #@30 (fn GAME EVENT &rest ARGS) (defalias 'chess-crafty-handler #[642 "?\205\304\267\202\355\305\306\307#\211\205*\310!\205*\311!\312=\205*\313\314\"\210\211\315\207\316\317\320\321\322@!\"\"\207\317\316\317\323\"\210\324\n\204T\211S\211\262\325V\203T\326\327\315\"\210\202>\n\207\211@\203`\316\317\330\"\207\316\317\331\"\207\332\333!\211\334\335\315\"\336\337\"\216r\211q\210\340@!\210\341c\210)r\211q\210\342\317\211\317\325%\210*\266\211 B\211\262\316\317\320\343\"\"\207\211@\344=\203\264\211A@\203\257\316\317\345\"\207\316\317\346\"\207\211@\347=\203\313\211A@\203\306\316\317\350\"\207\316\317\351\"\207\211@\352=\203\334\316\317\320\353A@\"\"\207\211@\354=\205\316\317\320\355A@\"\"\207\356=\203\357@\360\"\361U\203\362\363!\210\364\305$\207" [chess-engine-handling-event chess-engine-process chess-crafty-evaluation chess-common-temp-files #s(hash-table size 6 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (initialize 11 setup-pos 43 evaluate 54 analyze 86 setup-game 101 set-option 157)) chess-common-handler initialize "crafty" processp process-status run process-send-string "xboard\n" t chess-engine-send nil format "setboard %s\n" chess-pos-to-fen "display general\nscore\ndisplay nogeneral\n" 50 0 sit-for 0.1 "analyze\npost\n" "exit\nnopost\n" make-temp-file "chess" generate-new-buffer " *temp file*" make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] chess-insert-pgn 10 write-region "read %s\n" resign "resign 9\n" "resign -1\n" ponder "hard\n" "easy\n" search-depth "sd %d\n" search-time "st %d\n" undo mod 2 1 error "Cannot undo until after crafty moves" apply] 12 (#$ . 3074)]) (provide 'chess-crafty)