diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-12 20:21:58 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-12 20:21:58 +0000 |
| commit | 5df29686990334d699a6558d59b1e3bec102e3a7 (patch) | |
| tree | 40ba87257c37f964c1b6e52b77ed79fac6d6b06b | |
| parent | 758e770833d91fde40219e2f8bd9f8588b56706f (diff) | |
*** no comment ***
| -rw-r--r-- | TODO | 24 | ||||
| -rw-r--r-- | chess-display.el | 12 | ||||
| -rw-r--r-- | chess-engine.el | 14 | ||||
| -rw-r--r-- | chess-ics.el | 1 | ||||
| -rw-r--r-- | chess-network.el | 4 | ||||
| -rw-r--r-- | chess-random.el | 10 |
6 files changed, 42 insertions, 23 deletions
@@ -9,6 +9,15 @@ ---------------------------------------------------------------------- +- if I parse disambiguating information from chess-algebraic, store it + in the ply. Then, in ply-to-algebraic it won't need to be + calculated. Also, I can then easily announce it in chess-announce + +- when announcing abiguous pieces, name the rank/file ("e pawn") + +- restrict keyboard shorcutting so that it only looks if the move is + related to the given letter + - modify displays and engines so they ONLY keep game objects; thus set-start-position now is just set-position @@ -22,6 +31,9 @@ - the game should go inactive once I lose by stalemate/checkmate +- devise a better scheme for printing messages (use a catalog?) and + for when engines need to ask questions + - there needs to be much more robustness; it's too easy to get the game into an unplayable state right now @@ -38,26 +50,14 @@ - require `cl' into chess-ply, or break my dependency on cl -- until Fischer Random castling is fully supported, disable castling - in the positions generated by chess-random - - test making an en passant capture -- if I parse disambiguating information from chess-algebraic, store - this in the ply. Then, in ply-to-algebraic it won't need to be - calculated. Also, I can then easily announce it in chess-announce - -- when announcing abiguous pieces, name the rank/file ("e pawn") - - in chess-ics use a server-alist, and make the default handle be "guest". Allow a password to be specified, or a filename containing the password (HOST [PORT HANDLE PASSWORD HELPER HELPER-ARGS...]) -- restrict keyboard shorcutting so that it only looks if the move is - related to the given letter - ---------------------------------------------------------------------- - Use more asserts throughout the code diff --git a/chess-display.el b/chess-display.el index 3fe2023..eba1ce2 100644 --- a/chess-display.el +++ b/chess-display.el @@ -65,8 +65,14 @@ ,@body) ,@body))) -(defun chess-display-create (style perspective &optional read-only) - "Create a chess display, for displaying chess objects." +(defun chess-display-create (style perspective &optional main read-only) + "Create a chess display, for displaying chess objects. +The display is drawn using the given STYLE, from the PERSPECTIVE +color's point of view. If MAIN is non-nil, then this is a main +display, which means it will popup on significant events, and will +cause the underlying game object to be shutdown when it is destroyed. +If READ-ONLY is non-nil, then the display will not allow the user to +makes moves, or any other changes to the underlying game." (let* ((name (symbol-name style)) (handler (intern-soft (concat name "-handler")))) (unless handler @@ -77,6 +83,8 @@ (setq chess-display-style style chess-display-perspective perspective chess-display-event-handler handler) + (if main + (chess-display-set-main nil)) (add-hook 'kill-buffer-hook 'chess-display-quit nil t) (current-buffer)))) diff --git a/chess-engine.el b/chess-engine.el index 86916a1..60691f8 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -452,11 +452,11 @@ function in all cases; this is merely a bandwidth-saver." (if moving (goto-char chess-engine-current-marker))) (unless chess-engine-working (setq chess-engine-working t) - (unwind-protect - (save-excursion - (if chess-engine-last-pos - (goto-char chess-engine-last-pos) - (goto-char (point-min))) + (save-excursion + (if chess-engine-last-pos + (goto-char chess-engine-last-pos) + (goto-char (point-min))) + (unwind-protect (while (and (not (eobp)) (/= (line-end-position) (point-max))) (let ((triggers chess-engine-regexp-alist)) @@ -468,8 +468,8 @@ function in all cases; this is merely a bandwidth-saver." (setq triggers nil) (setq triggers (cdr triggers))))) (forward-line)) - (setq chess-engine-last-pos (point))) - (setq chess-engine-working nil))))))) + (setq chess-engine-last-pos (point) + chess-engine-working nil)))))))) (provide 'chess-engine) diff --git a/chess-ics.el b/chess-ics.el index 4b06a41..51eb94f 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -188,7 +188,6 @@ who is black." (chess-network-handler 'move (car args))) ((eq event 'send) - (message "sending string: %s" (car args)) (comint-send-string (get-buffer-process (current-buffer)) (car args))) diff --git a/chess-network.el b/chess-network.el index dee0647..c80487e 100644 --- a/chess-network.el +++ b/chess-network.el @@ -145,7 +145,9 @@ ((eq event 'move) (chess-engine-send nil (concat (chess-ply-to-algebraic (car args)) - "\n"))))) + "\n")) + (if (chess-game-over-p (chess-engine-game nil)) + (chess-game-set-data (chess-engine-game nil) 'active nil))))) (provide 'chess-network) diff --git a/chess-random.el b/chess-random.el index 3155373..210ba31 100644 --- a/chess-random.el +++ b/chess-random.el @@ -50,11 +50,21 @@ (throw 'retry t)) (setq first-rook i)))))) (setq position (chess-pos-create))))) + + ;; set the home row pieces (dotimes (i 8) (chess-pos-set-piece position (chess-rf-to-index 0 i) (aref pieces i)) (chess-pos-set-piece position (chess-rf-to-index 7 i) (upcase (aref pieces i)))) + + ;; jww (2002-04-12): Until I fully support Fischer Random + ;; castling, I will disable it here + (chess-pos-set-can-castle position ?K nil) + (chess-pos-set-can-castle position ?Q nil) + (chess-pos-set-can-castle position ?k nil) + (chess-pos-set-can-castle position ?q nil) + position)) (provide 'chess-random) |
