;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%\207" [require chess-algebraic chess-fen chess-pgn chess-module custom-declare-group chess-engine nil "Code for reading movements and other commands from an engine." :group chess] 6) (defvar chess-engine-regexp-alist nil) (defvar chess-engine-response-handler nil) (defvar chess-engine-current-marker nil) (defvar chess-engine-pending-offer nil) (defvar chess-engine-pending-arg nil) (defvar chess-engine-opponent-name nil) (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\207" [make-variable-buffer-local chess-engine-regexp-alist chess-engine-response-handler chess-engine-current-marker chess-engine-pending-offer chess-engine-pending-arg chess-engine-opponent-name] 2) (defvar chess-engine-process nil) (defvar chess-engine-last-pos nil) (defvar chess-engine-working nil) (defvar chess-engine-handling-event nil) (byte-code "\300\301!\210\300\302!\210\300\303!\207" [make-variable-buffer-local chess-engine-process chess-engine-last-pos chess-engine-working] 2) (defvar chess-engine-inhibit-auto-pass nil) (chess-message-catalog 'english '((invalid-fen . "Received invalid FEN string: %s") (invalid-pgn . "Received invalid PGN text") (now-black . "Your opponent played the first move, you are now black") (move-passed . "Your opponent has passed the move to you") (want-to-play . "Do you wish to play a chess game against %s? ") (want-to-play-a . "Do you wish to play a chess game against an anonymous opponent? ") (opp-quit . "Your opponent has quit playing") (opp-resigned . "Your opponent has resigned") (opp-draw . "Your opponent offers a draw, accept? ") (opp-abort . "Your opponent wants to abort this game, accept? ") (opp-undo . "Your opponent wants to take back %d moves, accept? ") (opp-ready . "Your opponent, %s, is now ready to play") (opp-ready-a . "Your opponent is ready to play; pass or make your move") (opp-draw-acc . "Your draw offer was accepted") (opp-abort-acc . "Your offer to abort was accepted") (opp-undo-acc . "Request to undo %d moves was accepted") (opp-draw-dec . "Your draw offer was declined") (opp-abort-dec . "Your offer to abort was declined") (opp-undo-dec . "Your request to undo %d moves was decline") (opp-draw-ret . "Your opponent has retracted their draw offer") (opp-abort-ret . "Your opponent has retracted their offer to abort") (opp-undo-ret . "Your opponent has retracted their request to undo %d moves") (opp-illegal . "Your opponent states your last command was illegal") (opp-call-flag . "Your flag fell, and your opponent has called time") (opp-flag-fell . "Your opponent has forfeited the game on time") (failed-start . "Failed to start chess engine process"))) #@163 Convert algebraic move to a ply in reference to the engine position. If conversion fails, this function fired an 'illegal event. (fn MOVE &optional TRUST-CHECK) (defalias 'chess-engine-convert-algebraic #[513 "\300\301\302!#\206\303\302\304\"\207" [chess-algebraic-to-ply chess-engine-position nil chess-engine-command illegal] 6 (#$ . 2833)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put chess-engine-convert-algebraic speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@12 (fn FEN) (defalias 'chess-engine-convert-fen #[257 "\300!\206\301\302C\303\304\305#!\266\207" [chess-fen-to-pos nil invalid-fen message apply chess-string] 9 (#$ . 3344)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put chess-engine-convert-fen speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@12 (fn PGN) (defalias 'chess-engine-convert-pgn #[257 "\300!\206\301\302\301\303\304\305#!\266\207" [chess-pgn-to-game nil invalid-pgn message apply chess-string] 9 (#$ . 3681)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put chess-engine-convert-pgn speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@57 Default engine response handler. (fn EVENT &rest ARGS) (defalias 'chess-engine-default-handler #[385 "\306\307!\310\267\202G\311@\205(\312\313\"\205( \204\244\312\314\"\203\244\211\211\204+\315\316!\210\211\211\2044\315\316!\210\3178\262GS\262\320U\203\244\321\322\n#\210\321\323 #\210\324\307\325\326\327#!\266\211\330C\204d\315\316!\210\f?\205\225\307\211\204s\315\316!\210\211@\262\211\203\220\211@\326@A$\262A\266\202\202w\262\262\266\312\314\"\203\244\331\314\307#\210\332@\"\210\211\211\204\263\315\316!\210\333\3178\334\"@\211\205\211\335\336\337\340\341\342\343&\206\211\211\211:\205\341\211@\344!\205\337\211G\345U\262\262\204\356\346\347\350\351E\"\210\211@\262\211\344!\205\375\211G\345U\262\204\n\346\347\352\353E\"\210\211\354H\262\211\205\335\355\356#\262\262\266\202\203'\331\313\307#\210\311)\207\312\313\"\205H\357\307\325\326\327#!\266\311\207\312\313\"\203M\360\307\361\"\210\202\210@G\320V\205W@\362\203d\327\363@\"\202g\327\364!!\203\202\211\206p\365\311\366\307!\210)\360\307\367#\266\202\210\360\307\370\"\266\311\207@\205H\311\366\307@\311#\210)\311\207@\205H\311\211\371\307@\"\210\331\313\311#\210 \322\204\273\315\316!\210\211\204\303\315\372!\210\211\204\314\315\316!\210\211A@\262\211\205\332\373\"A\266\203\230\203\351\331\314\311#\210\202\357\331\314\307#\210*\311\207\374\307\325\326\327#!\266\311\331\313\307#\210)\311\207\311\375\307\325\326\327#!\266\211\342\332\211\307\204#\315\316!\210\376\"\211\211:\205;\211@\344!\2059\211G\345U\262\262\204H\346\347\350\351E\"\210\211@\266\203D\"\266)\311\207\362\327\377!!\203\251\311\211\336\332\211\307\204l\315\316!\210\376\"\211\211:\205\204\211@\344!\205\202\211G\345U\262\262\204\221\346\347\350\351E\"\210\211@\266\203D\"\266\331\313\307#\210)\360\307\367\"\210\202\256\360\307\370\"\210\311\207\362\327\201A!!\203\311\211\343\332\211\307\204\312\315\316!\210\376\"\211\211:\205\342\211@\344!\205\340\211G\345U\262\262\204\357\346\347\350\351E\"\210\211@\266\203D\"\266\331\313\307#\210)\360\307\367\"\210\202\f\360\307\370\"\210\311\207\362\327\201B@\"!\203-\311\201C@\"\210)\360\307\367\"\210\2022\360\307\370\"\210\311\207 \205H \201D=\203\205\312\313\"\204V@G\320V\205Q@\211\203g\201E@C\325\326\327#!\266\202t\201F\307\325\326\327#!\266\211\206y\365\311\366\307!\210)\210\202V\311 \201G\267\202U\201H\307\325\326\327#!\266\211\336\332\211\307\204\252\315\316!\210\376\"\211\211:\205\302\211@\344!\205\300\211G\345U\262\262\204\317\346\347\350\351E\"\210\211@\266\203D\"\266\331\313\307#\210\202U\201I\307\325\326\327#!\266\211\343\332\211\307\204\374\315\316!\210\376\"\211\211:\205\211@\344!\205\211G\345U\262\262\204!\346\347\350\351E\"\210\211@\266\203D\"\266\331\313\307#\210\202U\201J@C\325\326\327#!\266\201C@\"\210\202U\201C@\"\210)\307\211@\311\207 \205H \201K\267\202\230\201L\307\325\326\327#!\266\202\230\201M\307\325\326\327#!\266\202\230\201N@C\325\326\327#!\266\307\211@\311\207 \205H \201O\267\202\332\201P\307\325\326\327#!\266\202\332\201Q\307\325\326\327#!\266\202\332\201R@C\325\326\327#!\266\307\211@\311\207\201S\307\325\326\327#!\266\311\201C\201T\")\207@\203\201U\202\312\312\314\"\203\201V\202\201W\"\211\320W\205k\201X\307\325\326\327#!\266\201YC\2048\315\316!\210\f?\205i\307\211\204G\315\316!\210\211@\262\211\203d\211@\326@A$\262A\266\202\202K\262\262\266\202\207\201Z\307\325\326\327#!\266\211\341\332\211\307\204\207\315\316!\210\376\"\211\211:\205\237\211@\344!\205\235\211G\345U\262\262\204\254\346\347\350\351E\"\210\211@\266\203D\"\266\331\313\307#\207\311\211\201[@D\204\314\315\316!\210\f?\205\375\307\211\204\333\315\316!\210\211@\262\211\203\370\211@\326@A$\262A\266\202\202\337\262\262\266\202)\207\311\211\201\\@D\204\315\316!\210\f?\205C\307\211\204!\315\316!\210\211@\262\211\203>\211@\326@A$\262A\266\202\202%\262\262\266\202)\207\307\207" [chess-engine-handling-event chess-engine-inhibit-auto-pass chess-engine-opponent-name chess-full-name chess-game-inhibit-events chess-engine-pending-offer chess-engine-game nil #s(hash-table size 18 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (move 9 pass 298 match 318 setup-pos 394 setup-game 411 quit 498 resign 520 draw 596 abort 688 undo 782 accept 820 decline 1117 retract 1183 illegal 1249 call-flag 1274 flag-fell 1388 kibitz 1467 chat 1537)) t chess-game-data active my-color cl--assertion-failed game 3 0 chess-game-set-tag "White" "Black" now-black message apply chess-string pass chess-game-set-data chess-game-move last 2 chess-ply-any-keyword :drawn :perpetual :repetition :flag-fell :resign :aborted vectorp 75 signal wrong-type-argument chess-ply ply chess-pos position 74 :stalemate :checkmate move-passed chess-engine-command busy y-or-n-p want-to-play want-to-play-a "Anonymous" chess-engine-set-position accept decline chess-engine-set-game tag assoc opp-quit opp-resigned chess-game-ply opp-draw chess-engine-pending-arg opp-abort opp-undo chess-game-undo match opp-ready opp-ready-a #s(hash-table size 4 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (draw 911 abort 993 undo 1075 my-undo 1101)) opp-draw-acc opp-abort-acc opp-undo-acc #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (draw 1129 abort 1145 undo 1161)) opp-draw-dec opp-abort-dec opp-undo-dec #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (draw 1195 abort 1211 undo 1227)) opp-draw-ret opp-abort-ret opp-undo-ret opp-illegal 1 -1 white-remaining black-remaining opp-call-flag flag-fell opp-flag-fell kibitz chat] 16 (#$ . 4021)]) #@178 Create a new chess engine MODULE (a symbol) associated with GAME. Optionally supply a new RESPONSE-HANDLER. (fn MODULE GAME &optional RESPONSE-HANDLER &rest HANDLER-CTOR-ARGS) (defalias 'chess-engine-create #[898 "\304\305\306%\211\205fr\211q\210\307\310\311!\312P!\313!\205\211\262J!\206)\314\n\211\203[\315!\203[\316!\317>\204H\320\306\321\304\322#!\266\323!\203V\323!\324=\203[\325\326\"\210\327 \330\331p#\262)\207" [chess-engine-regexp-alist chess-engine-response-handler chess-engine-process chess-engine-current-marker apply chess-module-create nil copy-alist intern-soft symbol-name "-regexp-alist" boundp chess-engine-default-handler processp process-status (run open listen) failed-start error chess-string process-filter internal-default-process-filter set-process-filter chess-engine-filter point-marker chess-game-set-data engine] 13 (#$ . 9954)]) (defalias 'chess-engine-destroy 'chess-module-destroy) #@90 Call the handler of ENGINE with EVENT (a symbol) and ARGS. (fn ENGINE EVENT &rest ARGS) (defalias 'chess-engine-command #[642 "\211\203r\211q\210\302 $)\207\302 $\207" [chess-module-event-handler chess-module-game apply] 9 (#$ . 10907)]) #@106 Set ENGINE OPTION to VALUE by invoking its handler with the 'set-option event. (fn ENGINE OPTION VALUE) (defalias 'chess-engine-set-option #[771 "\211\203r\211q\210\300\301$)\207\300\301$\207" [chess-engine-command set-option] 9 (#$ . 11162)]) #@80 Set a new RESPONSE-HANDLER for ENGINE. (fn ENGINE &optional RESPONSE-HANDLER) (defalias 'chess-engine-set-response-handler #[513 "\211\203r\211q\210\206\301\211)\207\206\301\211\207" [chess-engine-response-handler chess-engine-default-handler] 5 (#$ . 11422)]) #@88 Return the function currently defined as the response-handler for ENGINE. (fn ENGINE) (defalias 'chess-engine-response-handler #[257 "\211\211\203\fr\211q\210)\207\207" [chess-engine-response-handler] 3 (#$ . 11701)]) #@43 (fn ENGINE &optional POSITION MY-COLOR) (defalias 'chess-engine-set-position #[769 "\211\203or\211q\210\303\203\235 \204\304\305!\210\306!\204#\304\307!\210\211\306!\2050\211G\310U\262\204=\311\312\313\314E\"\210\211C\262C\204J\304\305!\210AA\205SC\241\210\315D\204a\304\305!\210?\205\222\316\211\204p\304\305!\210\211@\262\211\203\215\211@\317@A$\262A\266\202\202t\262\262\266\320 \321#\210\202( \n\204\247\304\305!\210\306!\204\261\304\307!\210\211\306!\205\276\211G\310U\262\204\313\311\312\313\314E\"\210\211C\262C\204\330\304\305!\210AA\205\341C\241\210\315D\204\357\304\305!\210?\205 \316\211\204\376\304\305!\210\211@\262\211\203\211@\317@A$\262A\266\202\202\262\262\266\320 \321\303#\210\320 \322\303#\210) \323C\204:\304\305!\210?\205k\316\211\204I\304\305!\210\211@\262\211\203f\211@\317@A$\262A\266\202\202M\262\262\266\202)\207\303\203 \204\304\305!\210\306!\204\211\304\307!\210\211\306!\205\226\211G\310U\262\204\243\311\312\313\314E\"\210\211C\262C\204\260\304\305!\210AA\205\271C\241\210\315D\204\307\304\305!\210?\205\370\316\211\204\326\304\305!\210\211@\262\211\203\363\211@\317@A$\262A\266\202\202\332\262\262\266\320 \321#\210\202\216 \n\204 \304\305!\210\306!\204\304\307!\210\211\306!\205$\211G\310U\262\2041\311\312\313\314E\"\210\211C\262C\204>\304\305!\210AA\205GC\241\210\315D\204U\304\305!\210?\205\206\316\211\204d\304\305!\210\211@\262\211\203\201\211@\317@A$\262A\266\202\202h\262\262\266\320 \321\303#\210\320 \322\303#\210) \323C\204\240\304\305!\210?\205\321\316\211\204\257\304\305!\210\211@\262\211\203\314\211@\317@A$\262A\266\202\202\263\262\262\207" [chess-game-inhibit-events chess-module-game chess-starting-position t cl--assertion-failed game vectorp (vectorp position) 75 signal wrong-type-argument chess-pos position setup-game nil apply chess-game-set-data my-color active orient] 18 (#$ . 11929)]) #@78 Return the current position of the game associated with ENGINE. (fn ENGINE) (defalias 'chess-engine-position #[257 "\211\211\203>r\211q\210\301\204\302\303!\210\304\"\211\211:\205+\211@\305!\205)\211G\306U\262\262\2048\307\310\311\312E\"\210\211@\266\203)\207\301\204H\302\303!\210\304\"\211\211:\205`\211@\305!\205^\211G\306U\262\262\204m\307\310\311\312E\"\210\211@\207" [chess-module-game nil cl--assertion-failed game chess-game-ply vectorp 75 signal wrong-type-argument chess-ply ply] 10 (#$ . 14006)]) (byte-code "\300\301\302\"\210\300\303\304\"\210\300\305\306\"\210\300\307\310\"\207" [defalias chess-engine-game chess-module-game chess-engine-set-game chess-module-set-game chess-engine-set-game* chess-module-set-game* chess-engine-index chess-module-game-index] 3) #@19 (fn ENGINE PLY) (defalias 'chess-engine-move #[514 "\211\203r\211q\210\301\"\210\302\303#)\207\301\"\210\302\303#\207" [chess-module-game chess-game-move chess-engine-command move] 7 (#$ . 14816)]) (chess-message-catalog 'english '((engine-not-running . "The engine you were using is no longer running"))) #@250 Send the given STRING to ENGINE. If `chess-engine-process' is a valid process object, use `process-send-string' to submit the data. Otherwise, the 'send event is triggered and the engine event handler can take care of the data. (fn ENGINE STRING) (defalias 'chess-engine-send #[514 "\211\2038r\211q\210\211\203/\301!\302>\203\303\"\2024\304\305\306\307\310#!\266\311\305\312\"\2024\311\305\313#\262)\207\211\203Z\301!\302>\203J\303\"\207\304\305\306\307\310#!\266\311\305\312\"\207\311\305\313#\207" [chess-engine-process process-status (run open) process-send-string engine-not-running nil message apply chess-string chess-engine-command destroy send] 11 (#$ . 15142)]) #@85 Submit the given STRING, so ENGINE sees it in its input stream. (fn ENGINE STRING) (defalias 'chess-engine-submit #[514 "\211\2034r\211q\210\211\203,\301!\203,\302!\303>\204,\304\305\306\307\310#!\266\311\305\312\"\210\313\305\"\262)\207\211\203W\301!\203W\302!\303>\204W\304\305\306\307\310#!\266\311\305\312\"\210\313\305\"\207" [chess-engine-process processp process-status (run open) engine-not-running nil message apply chess-string chess-engine-command destroy chess-engine-filter] 11 (#$ . 15847)]) #@19 (fn PROC EVENT) (defalias 'chess-engine-sentinel #[514 "\300\301!!\207" [chess-engine-destroy process-buffer] 5 (#$ . 16383)]) #@93 Filter for receiving text for an engine from an outside source. (fn PROC &optional STRING) (defalias 'chess-engine-filter #[513 "\203\306!\203\307!\202p\310\311\312!\205\277rq\210;\203*\262\202B` U\212 b\210c\210 `\311\223\210)\211\203A b\210\210\n?\205\276\310\212 \203T b\210\202Web\210\313\216m?\205\275\211?\205\275\311\f\311\211\203\247\314@@\315 \310#\203\235@A \211\262\203\235\211\316=\203\227\203\224A\241\210\202\227A\311\262\202i\262A\262\202i)\266\315 dU\203\267\310\262\202Y\311y\210\202Y*))\207" [inhibit-redisplay chess-engine-current-marker chess-engine-working chess-engine-last-pos chess-engine-regexp-alist case-fold-search processp process-buffer t nil buffer-live-p #[0 "`\302\211\207" [chess-engine-last-pos chess-engine-working nil] 2] re-search-forward line-end-position once] 13 (#$ . 16519)]) (provide 'chess-engine)