mlang pushed a commit to branch externals/chess in repository elpa. commit 7b6e18060cb5b3d494e60a91b52d7a8952cc27c0 Author: Mario Lang <ml...@delysid.org> Date: Tue Jun 3 23:15:03 2014 +0200
Let chess-algebraic.el depend on chess-ply.el, not the other way around. * chess-ply.el (chess-ply-to-string, chess-ply-from-string): Remove as they are just aliases. Update callers to use chess-ply-to-algebraic and chess-algebraic-to-ply instead. --- chess-algebraic.el | 1 + chess-epd.el | 9 +++++---- chess-ply.el | 10 ---------- chess-puzzle.el | 8 ++++++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/chess-algebraic.el b/chess-algebraic.el index 5b3e043..daab1ba 100644 --- a/chess-algebraic.el +++ b/chess-algebraic.el @@ -55,6 +55,7 @@ (eval-when-compile (require 'cl-lib)) (require 'chess-message) +(require 'chess-ply) (require 'chess-pos) (defconst chess-algebraic-regexp diff --git a/chess-epd.el b/chess-epd.el index 12b4eda..1c4a643 100644 --- a/chess-epd.el +++ b/chess-epd.el @@ -33,6 +33,7 @@ ;;; Code: +(require 'chess-algebraic) (require 'chess-fen) (require 'chess-game) (require 'chess-ply) @@ -46,7 +47,7 @@ ((or (eq opcode 'am) (eq opcode 'bm)) (cl-assert (consp value)) (format "%S %s;" - opcode (mapconcat #'chess-ply-to-string value " "))) + opcode (mapconcat #'chess-ply-to-algebraic value " "))) ((eq opcode 'ce) (cl-assert (integerp value)) (format "%S %d;" opcode value)) @@ -116,16 +117,16 @@ and advance point after the correctly parsed position." (cond ((or (eq opcode 'am) (eq opcode 'bm)) (mapcar (lambda (move) - (chess-ply-from-string pos move)) + (chess-algebraic-to-ply pos move)) (split-string val " "))) ((eq opcode 'ce) (read val)) ((or (eq opcode 'pm) (eq opcode 'sm)) ;predicted/supplied move - (chess-ply-from-string pos val)) + (chess-algebraic-to-ply pos val)) ((or (eq opcode 'pv) (eq opcode 'sv)) ; predicted/supplied variation (let ((var (chess-var-create pos))) (mapc (lambda (ply) - (let ((changes (chess-ply-from-string + (let ((changes (chess-algebraic-to-ply (chess-var-pos var) ply))) (if changes (chess-var-move var changes) diff --git a/chess-ply.el b/chess-ply.el index 51b85fb..26a832c 100644 --- a/chess-ply.el +++ b/chess-ply.el @@ -62,7 +62,6 @@ (eval-when-compile (require 'cl-lib)) (require 'chess-pos) -(require 'chess-algebraic) (defgroup chess-ply nil "Routines for manipulating chess plies." @@ -140,15 +139,6 @@ (chess-pos-set-preceding-ply position ply) (chess-ply-set-keyword ply :next-pos position)))) -(defsubst chess-ply-to-string (ply &optional long) - (cl-assert (listp ply)) - (chess-ply-to-algebraic ply long)) - -(defsubst chess-ply-from-string (position move) - (cl-assert (vectorp position)) - (cl-assert (stringp move)) - (chess-algebraic-to-ply position move)) - (defconst chess-piece-name-table '(("queen" . ?q) ("rook" . ?r) diff --git a/chess-puzzle.el b/chess-puzzle.el index d41e6a5..8b4da35 100644 --- a/chess-puzzle.el +++ b/chess-puzzle.el @@ -27,9 +27,13 @@ ;;; Code: +(require 'chess) +(require 'chess-algebraic) +(require 'chess-database) +(require 'chess-display) +(require 'chess-engine) (require 'chess-game) (require 'chess-random) -(require 'chess-database) (defgroup chess-puzzle nil "A mode for playing games from a database of puzzles." @@ -113,7 +117,7 @@ making it easy to go on to the next puzzle once you've solved one." (when (or bm pv) (message "Best move %s %s%s" (if (zerop (chess-game-index game)) "is" "would have been") - (chess-ply-to-string (car bm)) + (chess-ply-to-algebraic (car bm)) (if pv (concat ", predicted variation " (chess-var-to-algebraic pv))