1 |
;;; gomoku.el --- Gomoku game between you and Emacs |
;;; gomoku.el --- Gomoku game between you and Emacs |
2 |
|
|
3 |
;; Copyright (C) 1988, 1994, 1996, 2001 Free Software Foundation, Inc. |
;; Copyright (C) 1988, 1994, 1996, 2001, 2003 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr> |
;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr> |
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
80 |
:type 'hook |
:type 'hook |
81 |
:group 'gomoku) |
:group 'gomoku) |
82 |
|
|
83 |
;;; |
;;; |
84 |
;;; CONSTANTS FOR BOARD |
;;; CONSTANTS FOR BOARD |
85 |
;;; |
;;; |
86 |
|
|
147 |
(define-key gomoku-mode-map [mouse-2] 'gomoku-mouse-play) |
(define-key gomoku-mode-map [mouse-2] 'gomoku-mouse-play) |
148 |
(define-key gomoku-mode-map [drag-mouse-2] 'gomoku-mouse-play) |
(define-key gomoku-mode-map [drag-mouse-2] 'gomoku-mouse-play) |
149 |
|
|
150 |
(substitute-key-definition 'previous-line 'gomoku-move-up |
(define-key gomoku-mode-map [remap previous-line] 'gomoku-move-up) |
151 |
gomoku-mode-map (current-global-map)) |
(define-key gomoku-mode-map [remap next-line] 'gomoku-move-down) |
152 |
(substitute-key-definition 'next-line 'gomoku-move-down |
(define-key gomoku-mode-map [remap beginning-of-line] 'gomoku-beginning-of-line) |
153 |
gomoku-mode-map (current-global-map)) |
(define-key gomoku-mode-map [remap end-of-line] 'gomoku-end-of-line) |
154 |
(substitute-key-definition 'beginning-of-line 'gomoku-beginning-of-line |
(define-key gomoku-mode-map [remap undo] 'gomoku-human-takes-back) |
155 |
gomoku-mode-map (current-global-map)) |
(define-key gomoku-mode-map [remap advertised-undo] 'gomoku-human-takes-back)) |
|
(substitute-key-definition 'end-of-line 'gomoku-end-of-line |
|
|
gomoku-mode-map (current-global-map)) |
|
|
(substitute-key-definition 'undo 'gomoku-human-takes-back |
|
|
gomoku-mode-map (current-global-map)) |
|
|
(substitute-key-definition 'advertised-undo 'gomoku-human-takes-back |
|
|
gomoku-mode-map (current-global-map))) |
|
156 |
|
|
157 |
(defvar gomoku-emacs-won () |
(defvar gomoku-emacs-won () |
158 |
"For making font-lock use the winner's face for the line.") |
"For making font-lock use the winner's face for the line.") |
840 |
gomoku-square-height) |
gomoku-square-height) |
841 |
1) |
1) |
842 |
gomoku-board-height)))) |
gomoku-board-height)))) |
843 |
|
|
844 |
(defun gomoku-mouse-play (click) |
(defun gomoku-mouse-play (click) |
845 |
"Play at the square where you click." |
"Play at the square where you click." |
846 |
(interactive "e") |
(interactive "e") |
1150 |
"Move point down one row on the Gomoku board." |
"Move point down one row on the Gomoku board." |
1151 |
(interactive) |
(interactive) |
1152 |
(if (< (gomoku-point-y) gomoku-board-height) |
(if (< (gomoku-point-y) gomoku-board-height) |
1153 |
(next-line gomoku-square-height))) |
(let ((column (current-column))) |
1154 |
|
(forward-line gomoku-square-height) |
1155 |
|
(move-to-column column)))) |
1156 |
|
|
1157 |
(defun gomoku-move-up () |
(defun gomoku-move-up () |
1158 |
"Move point up one row on the Gomoku board." |
"Move point up one row on the Gomoku board." |
1159 |
(interactive) |
(interactive) |
1160 |
(if (> (gomoku-point-y) 1) |
(if (> (gomoku-point-y) 1) |
1161 |
(previous-line gomoku-square-height))) |
(let ((column (current-column))) |
1162 |
|
(forward-line (- 1 gomoku-square-height)) |
1163 |
|
(move-to-column column)))) |
1164 |
|
|
1165 |
(defun gomoku-move-ne () |
(defun gomoku-move-ne () |
1166 |
"Move point North East on the Gomoku board." |
"Move point North East on the Gomoku board." |