Function: gomoku-human-plays

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

Signature

(gomoku-human-plays)

Documentation

Signal to the Gomoku program that you have played.

You must have put the cursor on the square where you want to play. If the game is finished, this command requests for another game.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/play/gomoku.el.gz
(defun gomoku-human-plays ()
  "Signal to the Gomoku program that you have played.
You must have put the cursor on the square where you want to play.
If the game is finished, this command requests for another game."
  (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
    (let (square score)
      (setq square (gomoku-point-square))
      (cond ((null square)
	     (error "Your point is not on a square.  Retry!"))
	    ((not (zerop (aref gomoku-board square)))
	     (error "Your point is not on a free square.  Retry!"))
	    (t
	     (setq score (aref gomoku-score-table square))
	     (gomoku-play-move square 1)
	     (cond ((and (>= score gomoku-losing-threshold)
			 ;; Just testing SCORE > THRESHOLD is not enough for
			 ;; detecting wins, it just gives an indication that
			 ;; we confirm with GOMOKU-FIND-FILLED-QTUPLE.
			 (gomoku-find-filled-qtuple square 1))
		    (gomoku-terminate-game 'human-won))
		   (t
		    (gomoku-emacs-plays)))))))))