diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-30 19:32:39 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-30 19:32:39 +0000 |
| commit | d4993c54eb9b6ab904db8ed43189ac0b561092aa (patch) | |
| tree | f01a18bc5e25f86335a55fd5b8c6b22c197ac913 | |
| parent | f8cec448f1d65c0576734e26bb239979409835a9 (diff) | |
bug fixes
| -rw-r--r-- | PLAN | 32 | ||||
| -rw-r--r-- | TODO | 9 | ||||
| -rw-r--r-- | chess-common.el | 6 | ||||
| -rw-r--r-- | chess-display.el | 26 | ||||
| -rw-r--r-- | chess-engine.el | 2 | ||||
| -rw-r--r-- | chess-game.el | 3 | ||||
| -rw-r--r-- | chess-gnuchess.el | 8 | ||||
| -rw-r--r-- | chess-images.el | 11 | ||||
| -rw-r--r-- | chess-pgn.el | 6 | ||||
| -rw-r--r-- | chess-puzzle.el | 4 |
10 files changed, 57 insertions, 50 deletions
@@ -1,33 +1,11 @@ -polish: chess-chat, chess-kibitz -translate: chess-german +chess-ics, chess-kibitz, chess-chat +- finish all elements of regular use as a client -chess -- clean up this code; let people override the chess-default-* lists +chess-german +- complete translation chess-ply -- Need to detect games drawn by three-fold repetition - -chess-engine -- add a `force' event for forcing an engine to move - -chess-puzzle -- after hitting chess-puzzle-next, clear out the engine so that it - doesn't try to respond - -chess-ics -- detect draw/retract, etc. -- allow ICS observing - -chess-display -- after Rhe1 in one game, the source rook was not cleared - -chess-gnuchess -- setting up game positions does not work at all, such as with - chess-puzzle - -chess-images -- in a generic emacs, with a light background, there are white lines - in wierd places on the chessboard +- detect games drawn by three-fold repetition BEFORE FINAL RELEASE @@ -4,6 +4,15 @@ These are features scheduled for future 2.x releases. General Features +- Add a `force' event for forcing an engine to move, and a command + from chess-display to send this event + +- If you are playing a puzzle game, and the engine is thinking, and + you hit space to move to the next puzzle, then when the last move is + finally received from the engine it causes an error. + +- Clean up chess.el, and let people override the chess-default-* lists + - Write chess-descriptive.el, and have the code in general use chess-ply-to-string and chess-string-to-ply, so that users can use descriptive notationas an alternative to algebraic. diff --git a/chess-common.el b/chess-common.el index 2c590a6..22bedcc 100644 --- a/chess-common.el +++ b/chess-common.el @@ -27,7 +27,8 @@ (starting-engine-done . "Starting chess program '%s'...done") (could-not-find-engine . "Cannot find %s executable; check `%s'") (draw-offer-declined . "Your draw offer was declined") - (illegal-move . "Illegal move"))) + (illegal-move . "Illegal move") + (not-yet-implemented . "This feature is not yet implemented"))) (defun chess-common-handler (game event &rest args) "Initialize the network chess engine." @@ -68,6 +69,9 @@ (chess-engine-send nil "new\n") (chess-engine-set-position nil)) + ((eq event 'force) + (chess-error 'not-yet-implemented)) + ((eq event 'undo) (dotimes (i (car args)) (chess-engine-send nil "undo\n")) diff --git a/chess-display.el b/chess-display.el index 97a3b9c..23938fe 100644 --- a/chess-display.el +++ b/chess-display.el @@ -251,8 +251,7 @@ also view the same game." "Update the chessboard DISPLAY. POPUP too, if that arg is non-nil." (chess-with-current-buffer display (funcall chess-display-event-handler 'draw - (chess-display-position nil) - (chess-display-perspective nil)) + (chess-display-position nil) chess-display-perspective) (if (and popup (not chess-display-no-popup) (chess-module-leader-p nil)) (chess-display-popup nil)))) @@ -277,9 +276,15 @@ also view the same game." (aset chess-display-index-positions pos-index pos)) (setq pos (next-single-property-change pos 'chess-coord))) (unless (aref chess-display-index-positions 0) - (aset chess-display-index-positions 0 (point-min))) + (aset chess-display-index-positions 0 + (if chess-display-perspective + (point-min) + (1- (point-max))))) (unless (aref chess-display-index-positions 63) - (aset chess-display-index-positions 63 (1- (point-max)))))) + (aset chess-display-index-positions 63 + (if chess-display-perspective + (1- (point-max)) + (point-min)))))) (aref chess-display-index-positions index))) (defun chess-display-paint-move (display ply) @@ -504,6 +509,7 @@ See `chess-display-type' for the different kinds of displays." (define-key map [(control ?c) (control ?a)] 'chess-display-abort) (define-key map [?C] 'chess-display-duplicate) (define-key map [?D] 'chess-display-decline) + (define-key map [(control ?c) (control ?c)] 'chess-display-force) (define-key map [(control ?c) (control ?d)] 'chess-display-draw) (define-key map [?E] 'chess-display-edit-board) (define-key map [?F] 'chess-display-set-from-fen) @@ -602,7 +608,7 @@ Basically, it means we are playing, not editing or reviewing." (defun chess-display-invert () "Invert the perspective of the current chess board." (interactive) - (chess-display-set-perspective nil (not (chess-display-perspective nil)))) + (chess-display-set-perspective nil (not chess-display-perspective))) (defun chess-display-set-from-fen (fen) "Send the current board configuration to the user." @@ -761,14 +767,14 @@ Basically, it means we are playing, not editing or reviewing." (require 'chess-images) (let ((chess-images-separate-frame display)) (chess-display-clone (current-buffer) 'chess-images - (chess-display-perspective nil)))) + chess-display-perspective))) (defun chess-display-duplicate (style) (interactive (list (concat "chess-" (read-from-minibuffer "Create new display using style: ")))) (chess-display-clone (current-buffer) (intern-soft style) - (chess-display-perspective nil))) + chess-display-perspective)) (defun chess-display-pass () "Pass the move to your opponent. Only valid on the first move." @@ -816,6 +822,12 @@ Basically, it means we are playing, not editing or reviewing." (chess-game-run-hooks chess-module-game 'call-flag) (ding))) +(defun chess-display-force () + (interactive) + (if (chess-display-active-p) + (chess-game-run-hooks chess-module-game 'force) + (ding))) + (defun chess-display-resign () "Resign the current game." (interactive) diff --git a/chess-engine.el b/chess-engine.el index adce754..4a04c0d 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -299,7 +299,7 @@ (unless (process-filter proc) (set-process-filter proc 'chess-engine-filter))) (setq chess-engine-current-marker (point-marker)) - (current-buffer)))))) + (chess-game-set-data game 'engine (current-buffer))))))) (defalias 'chess-engine-destroy 'chess-module-destroy) diff --git a/chess-game.el b/chess-game.el index 5bb53a6..586f656 100644 --- a/chess-game.el +++ b/chess-game.el @@ -132,7 +132,8 @@ matches." (setcar (nthcdr 2 game) (list (cons key value))) (push (cons key value) alist) (setcar (nthcdr 2 game) alist))) - (chess-game-run-hooks game 'set-data key))) + (chess-game-run-hooks game 'set-data key) + value)) (defun chess-game-data (game key) (assert game) diff --git a/chess-gnuchess.el b/chess-gnuchess.el index c867473..5281774 100644 --- a/chess-gnuchess.el +++ b/chess-gnuchess.el @@ -53,9 +53,11 @@ (chess-engine-send nil (format "epdload %s\n" file)))) ((eq event 'setup-game) - (let ((file (chess-with-temp-file - (insert (chess-game-to-string (car args)) ?\n)))) - (chess-engine-send nil (format "pgnload %s\n" file)))) + (if (= 0 (chess-game-index (car args))) + (chess-gnuchess-handler game 'setup-pos (chess-game-pos game 0)) + (let ((file (chess-with-temp-file + (insert (chess-game-to-string (car args)) ?\n)))) + (chess-engine-send nil (format "pgnload %s\n" file))))) ((eq event 'pass) (chess-engine-send nil (concat (if (chess-pos-side-to-move diff --git a/chess-images.el b/chess-images.el index 5ffa01d..fa01def 100644 --- a/chess-images.el +++ b/chess-images.el @@ -232,12 +232,12 @@ called." "Return the image used for PIECE at RANK and FILE. Rank and file are important because the colors of the squares on the chess board are light or dark depending on location." - (let ((white-square (% (+ file rank) 2))) + (let ((square-color (% (+ file rank) 2))) ; 0 is white (if (= piece ? ) - (aref chess-images-cache (+ white-square 2)) + (aref chess-images-cache (- 3 square-color)) (aref (aref (aref chess-images-cache (if (> piece ?a) 0 1)) - white-square) + (if (= square-color 0) 1 0)) (nth 2 (assq (downcase piece) chess-images-piece-names)))))) @@ -390,6 +390,7 @@ They are returned in ascending order, or nil for no sizes available." "Increase the size of the pieces on the board." (interactive "DUse chess pieces in: ") (setq chess-images-directory directory + chess-images-sizes (chess-images-sizes) chess-images-size (chess-images-best-size) chess-images-cache nil) (chess-images-alter-size '=)) @@ -400,8 +401,8 @@ They are returned in ascending order, or nil for no sizes available." (insert "static char *chessdotel[] = {\n") (insert "/* columns rows colors chars-per-pixel */\n") (insert (format "\"%d %d 2 1\",\n" (or width height) height)) - (insert "\" c black s void\",\n") - (insert "\". c white s background\",\n") + (insert "\" c red s void\",\n") + (insert "\". c red s background\",\n") (insert "/* pixels */\n") (dotimes (i height) (insert ?\" (make-string (or width height) ?.) ?\" ?, ?\n)) diff --git a/chess-pgn.el b/chess-pgn.el index 339b6f0..af212c5 100644 --- a/chess-pgn.el +++ b/chess-pgn.el @@ -136,12 +136,12 @@ If INDENTED is non-nil, indent the move texts." (defun chess-insert-pgn (game &optional indented) (let ((fen (chess-game-tag game "FEN")) - (first-pos (chess-ply-pos (chess-game-ply game 0)))) - (when (and fen (not (equal fen (chess-pos-to-fen first-pos)))) + (first-pos (chess-game-pos game 0))) + (when (and fen (not (string= fen (chess-pos-to-fen first-pos)))) (chess-game-del-tag game "FEN") (setq fen nil)) (if (and (not fen) - (not (equal chess-starting-position first-pos))) + (not (eq chess-starting-position first-pos))) (chess-game-set-tag game "FEN" (chess-pos-to-fen first-pos)))) (dolist (tag (sort (copy-alist (chess-game-tags game)) (function diff --git a/chess-puzzle.el b/chess-puzzle.el index 84ca6f5..53de243 100644 --- a/chess-puzzle.el +++ b/chess-puzzle.el @@ -63,12 +63,12 @@ making it easy to go on to the next puzzle once you've solved one." next-game) (if (= index (length chess-puzzle-indices)) (chess-message 'end-of-puzzles) + ;; setup and load the next puzzle position (setq chess-puzzle-position (1+ chess-puzzle-position)) (if (null (setq next-game (chess-database-read database (aref chess-puzzle-indices index)))) - (chess-error 'bag-game-read - (aref chess-puzzle-indices index)) + (chess-error 'bag-game-read (aref chess-puzzle-indices index)) (chess-display-set-game nil next-game 0) (chess-game-set-data game 'my-color (chess-pos-side-to-move (chess-game-pos game))) |
