• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/play/

Lines Matching defs:game

1 ;;; gomoku.el --- Gomoku game between you and Emacs
32 ;; Gomoku is a game played between two players on a rectangular board. Each
73 "Gomoku game between you and Emacs."
292 ;; qtuple is winning the game. Just after this comes the "XXXX" qtuple because
293 ;; not playing in it is just loosing the game, and so on. Note that a
572 ;; Several variables are used to monitor a game, including a GAME-HISTORY (the
577 (defvar gomoku-game-in-progress nil
578 "Non-nil if a game is in progress.")
580 (defvar gomoku-game-history nil
581 "A record of all moves that have been played during current game.")
584 "Number of moves already played in current game.")
587 "Number of moves already played by human in current game.")
593 "Non-nil if Human took back a move during the game.")
603 (defun gomoku-start-game (n m)
604 "Initialize a new game on an N by M board."
606 (setq gomoku-game-in-progress t)
612 gomoku-game-history nil
630 (setq gomoku-game-history
632 gomoku-game-history)
644 (let* ((last-move (car gomoku-game-history))
649 (setq gomoku-game-history (cdr gomoku-game-history)
672 (defun gomoku-terminate-game (result)
673 "Terminate the current game with RESULT."
721 ((eq result 'crash-game)
722 "Sorry, I have been interrupted and cannot resume that game...")))
725 (setq gomoku-game-in-progress nil))
727 (defun gomoku-crash-game ()
730 (gomoku-terminate-game 'crash-game)
732 (gomoku-prompt-for-other-game))
741 "Start a Gomoku game between you and Emacs.
743 If a game is in progress, this command allow you to resume it.
755 Gomoku game, and ought to be upgraded to use the full modern rules.
762 ;; from gomoku-prompt-for-other-game.
765 (when gomoku-game-in-progress
767 (gomoku-terminate-game 'crash-game)
769 (or (y-or-n-p "Another game? ") (error "Chicken!")))
774 (gomoku-crash-game))
775 ((or (not gomoku-game-in-progress)
793 (gomoku-start-game n m)
797 ((y-or-n-p "Shall we continue our game? ")
808 (gomoku-crash-game))
809 ((not gomoku-game-in-progress)
810 (gomoku-prompt-for-other-game))
816 (gomoku-terminate-game 'nobody-won))
823 (gomoku-terminate-game 'emacs-won))
825 (gomoku-terminate-game 'nobody-won))
829 (gomoku-terminate-game 'draw-agreed))
874 If the game is finished, this command requests for another game."
879 (gomoku-crash-game))
880 ((not gomoku-game-in-progress)
881 (gomoku-prompt-for-other-game))
897 (gomoku-terminate-game 'human-won))
907 (gomoku-crash-game))
908 ((not gomoku-game-in-progress)
911 (gomoku-prompt-for-other-game))
931 (gomoku-crash-game))
932 ((not gomoku-game-in-progress)
933 (message "There is no game in progress"))
935 (gomoku-terminate-game 'human-resigned))
939 (gomoku-terminate-game 'human-resigned)))) ; OK. Accept it
955 (defun gomoku-prompt-for-other-game ()
956 "Ask for another game, and start it."
957 (if (y-or-n-p "Another game? ")
1095 (if gomoku-game-in-progress
1096 (gomoku-crash-game)) ; buffer has been killed or something