Function: landmark-emacs-plays

landmark-emacs-plays is an interactive and byte-compiled function defined in landmark.el.gz.

Signature

(landmark-emacs-plays)

Documentation

Compute Emacs next move and play it.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/landmark.el.gz
;;;_ +  INTERACTIVE COMMANDS.

(defun landmark-emacs-plays ()
  "Compute Emacs next move and play it."
  (interactive)
  (landmark-switch-to-window)
  (cond
   (landmark-emacs-is-computing
    (landmark-crash-game))
   ((not landmark-game-in-progress)
    (landmark-prompt-for-other-game))
   (t
    (message "Let me think...")
    (let ((square (landmark-strongest-square))
          score)
      (cond ((null square)
	     (landmark-terminate-game 'nobody-won))
	    (t
	     (setq score (aref landmark-score-table square))
	     (landmark-play-move square 6)
	     (cond ((>= score landmark-winning-threshold)
		    (setq landmark-emacs-won t) ; for font-lock
		    (landmark-find-filled-qtuple square 6)
		    (landmark-terminate-game 'emacs-won))
		   ((zerop score)
		    (landmark-terminate-game 'nobody-won))
		   ((and (> landmark-number-of-moves landmark-draw-limit)
			 (not landmark-human-refused-draw)
			 (landmark-offer-a-draw))
		    (landmark-terminate-game 'draw-agreed))
		   (t
		    (landmark-prompt-for-move)))))))))