Function: gomoku-terminate-game

gomoku-terminate-game is a byte-compiled function defined in gomoku.el.gz.

Signature

(gomoku-terminate-game RESULT)

Documentation

Terminate the current game with RESULT.

Source Code

;; Defined in /usr/src/emacs/lisp/play/gomoku.el.gz
(defun gomoku-terminate-game (result)
  "Terminate the current game with RESULT."
  (message
   (cond
    ((eq result 'emacs-won)
     (setq gomoku-number-of-emacs-wins (1+ gomoku-number-of-emacs-wins))
     (cond ((< gomoku-number-of-moves 20)
	    "I won...  I hope you like the game as you get better.")
	   (gomoku-human-refused-draw
	    "I won...  Too bad you refused my offer of a draw!")
	   (gomoku-human-took-back
	    "I won...  It's OK to take back more moves next time.")
	   ((not gomoku-emacs-played-first)
	    "I won...  Use C-c C-b to take back a move on second thought.")
	   ((and (zerop gomoku-number-of-human-wins)
		 (zerop gomoku-number-of-draws)
		 (> gomoku-number-of-emacs-wins 1))
	    "I won...  It might be time take a break before trying again.")
	   ("I won.")))
    ((eq result 'human-won)
     (setq gomoku-number-of-human-wins (1+ gomoku-number-of-human-wins))
     (concat "OK, you won this one."
	     (cond
	      (gomoku-human-took-back
	       "  For a bigger challenge, play without taking moves back.")
	      (gomoku-emacs-played-first
	       "  Congratulations!")
	      ("  For a bigger challenge, let me play first."))))
    ((eq result 'human-resigned)
     (setq gomoku-number-of-emacs-wins (1+ gomoku-number-of-emacs-wins))
     "I see that you resigned.  Better luck next time.")
    ((eq result 'nobody-won)
     (setq gomoku-number-of-draws (1+ gomoku-number-of-draws))
     (concat "This is a draw.  "
	     (cond
	      (gomoku-human-took-back
	       "  For a bigger challenge, try without taking moves back.")
	      (gomoku-emacs-played-first
	       "Wow, that was a long game.  We both played well.")
	      ("  For a bigger challenge, let me play first."))))
    ((eq result 'draw-agreed)
     (setq gomoku-number-of-draws (1+ gomoku-number-of-draws))
     (concat "Draw agreed.  "
	     (cond
	      (gomoku-human-took-back
	       "  For a bigger challenge, try without taking moves back.")
	      (gomoku-emacs-played-first
	       "Good game.")
	      ("  For a bigger challenge, let me play first."))))
    ((eq result 'crash-game)
     "Sorry, I have been interrupted and cannot resume that game...")))
  (gomoku-display-statistics)
  ;;(ding)
  (setq gomoku-game-in-progress nil))