diff options
| author | Mario Lang <mlang@delysid.org> | 2014-06-04 22:43:13 +0200 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2014-06-04 22:43:13 +0200 |
| commit | d3bd3c6f07e0c9a2a7a1488e43b47439a5f8ac54 (patch) | |
| tree | 6880ccc0d0694bd1af272c90108d68d95b58791e /chess-puzzle.el | |
| parent | 4f6e6e7cac21f21586b221e2a65e657a4c2a7213 (diff) | |
Sync from ELPA.
Diffstat (limited to 'chess-puzzle.el')
| -rw-r--r-- | chess-puzzle.el | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chess-puzzle.el b/chess-puzzle.el index 216aa30..8b4da35 100644 --- a/chess-puzzle.el +++ b/chess-puzzle.el @@ -1,6 +1,6 @@ ;;; chess-puzzle.el --- Support for viewing and solving chess puzzles -;; Copyright (C) 2002, 2004, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc. ;; Author: John Wiegley <johnw@gnu.org> ;; Maintainer: Mario Lang <mlang@delysid.org> @@ -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." @@ -51,7 +55,7 @@ (end-of-puzzles . "There are no more puzzles in this collection"))) ;;;###autoload -(defun chess-puzzle (file &optional index) +(defun chess-puzzle (file &optional index) ;FIXME: index not used! "Pick a random puzzle from FILE, and solve it against the default engine. The spacebar in the display buffer is bound to `chess-puzzle-next', making it easy to go on to the next puzzle once you've solved one." @@ -80,6 +84,8 @@ making it easy to go on to the next puzzle once you've solved one." (chess-game-run-hooks (chess-display-game display) 'disable-autosave) (chess-puzzle-next))))) +(defvar chess-display-handling-event) + (defun chess-puzzle-next () "Play the next puzzle in the collection, selected randomly." (interactive) @@ -111,14 +117,14 @@ 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)) ""))))))) -(defun chess-puzzle-handler (game display event &rest args) +(defun chess-puzzle-handler (game display event &rest _args) (if (and (eq event 'move) (chess-game-over-p game)) (with-current-buffer display |
