Function: gomoku-emacs-plays

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

Signature

(gomoku-emacs-plays)

Documentation

Compute Emacs next move and play it.

Key Bindings

Source Code

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