-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Convert a ply to/from standard chess algebraic notation
-;;
+;;; chess-algebraic.el --- Convert a ply to/from standard chess algebraic notation
+
+;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@gnu.org>
+;; Maintainer: Mario Lang <mlang@delysid.org>
+;; Keywords: games
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
;; A thing to deal with in chess is algebraic move notation, such as
;; Nxf3+. (I leave description of this notation to better manuals
;; than this). This notation is a shorthand way of representing where
;; buffer:
;;
;; chess-algebraic-regexp
-;;
-(eval-when-compile (require 'cl))
+;;; Code:
+
+(eval-when-compile (require 'cl-lib))
(require 'chess-message)
(require 'chess-pos)
(defun chess-algebraic-to-ply (position move &optional trust)
"Convert the algebraic notation MOVE for POSITION to a ply."
- (assert (vectorp position))
- (assert (stringp move))
+ (cl-assert (vectorp position))
+ (cl-assert (stringp move))
(let ((case-fold-search nil))
(when (string-match chess-algebraic-regexp-entire move)
(let ((color (chess-pos-side-to-move position))
(from (chess-ply-source ply))
(to (chess-ply-target ply))
(from-piece (chess-pos-piece pos from))
- (color (chess-pos-side-to-move pos))
(rank 0) (file 0)
(from-rank (chess-index-rank from))
(from-file (chess-index-file from))
(defun chess-ply-to-algebraic (ply &optional long)
"Convert the given PLY to algebraic notation.
If LONG is non-nil, render the move into long notation."
- (assert (listp ply))
+ (cl-assert (listp ply))
(or (and (not long) (chess-ply-keyword ply :san))
(and (null (chess-ply-source ply)) "")
(let ((move (chess-ply--move-text ply long)))