diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-03-01 08:08:28 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-03-01 08:08:28 +0000 |
| commit | 059e5edba1175504698637f734eb5bf975b299fa (patch) | |
| tree | 95e6f08169d73d1ce763ae90945204783c0132eb /chess-pgn.el | |
| parent | f115e4627966ae900aef55cb10f9e6207dbe7adf (diff) | |
Playing against crafty now works.
Diffstat (limited to 'chess-pgn.el')
| -rw-r--r-- | chess-pgn.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chess-pgn.el b/chess-pgn.el index 56fab5a..7c4fe93 100644 --- a/chess-pgn.el +++ b/chess-pgn.el @@ -6,8 +6,9 @@ (require 'chess-game) (require 'chess-algebraic) +(require 'chess-fen) -(defun chess-pgn-read-plies (position &optional top-level) +(defun chess-pgn-read-plies (game position &optional top-level) (let ((plies (list t)) prevpos done) (while (not (or done (eobp))) (cond @@ -34,8 +35,8 @@ ((looking-at "(") (forward-char) (skip-chars-forward " \t\n") - (chess-pos-add-annotation prevpos (chess-pgn-read-plies - (chess-pos-copy prevpos)))) + (chess-pos-add-annotation + prevpos (chess-pgn-read-plies game (chess-pos-copy prevpos)))) ((and (not top-level) (looking-at ")")) (forward-char) @@ -57,12 +58,12 @@ (let ((fen (chess-game-tag game "FEN"))) (chess-game-set-plies game (chess-pgn-read-plies - (if fen - (chess-fen-to-position fen) - (chess-pos-copy chess-starting-position)) t))) + game (if fen + (chess-fen-to-pos fen) + (chess-pos-copy chess-starting-position)) t))) game))) -(defun chess-pgn-insert-annotations (ply) +(defun chess-pgn-insert-annotations (index ply) (dolist (ann (chess-pos-annotations (chess-ply-pos ply))) (if (stringp ann) (insert (format " {%s}" ann)) @@ -75,14 +76,14 @@ (unless for-black (insert (format "%d. %s" index (chess-ply-to-algebraic (car plies)))) - (chess-pgn-insert-annotations (car plies)) + (chess-pgn-insert-annotations index (car plies)) (setq plies (cdr plies) index (1+ index))) (when plies (when for-black (insert (format "%d. ..." index)) (setq for-black nil)) (insert (format " %s" (chess-ply-to-algebraic (car plies)))) - (chess-pgn-insert-annotations (car plies)) + (chess-pgn-insert-annotations index (car plies)) (setq plies (cdr plies))) (if plies (insert ? )))) |
