Function: solitaire-possible-move
solitaire-possible-move is a byte-compiled function defined in
solitaire.el.gz.
Signature
(solitaire-possible-move MOVESYMBOL)
Documentation
Check if a move is possible from current point in the specified direction.
MOVESYMBOL specifies the direction. Returns either a string, indicating cause of contraindication, or a list containing three numbers: starting field, skipped field (from which a stone will be taken away) and target.
Source Code
;; Defined in /usr/src/emacs/lisp/play/solitaire.el.gz
(defun solitaire-possible-move (movesymbol)
"Check if a move is possible from current point in the specified direction.
MOVESYMBOL specifies the direction.
Returns either a string, indicating cause of contraindication, or a
list containing three numbers: starting field, skipped field (from
which a stone will be taken away) and target."
(save-excursion
(if (memq movesymbol solitaire-valid-directions)
(let ((start (point))
(skip (progn (funcall movesymbol) (point)))
(target (progn (funcall movesymbol) (point))))
(if (= skip target)
"Off Board!"
(if (or (/= ?o (char-after start))
(/= ?o (char-after skip))
(/= ?. (char-after target)))
"Wrong move!"
(list start skip target))))
"Not a valid direction")))