Mercurial > emacs
comparison lisp/play/gomoku.el @ 42205:7308bbc423d5
Doc fixes.
author | Pavel Janík <Pavel@Janik.cz> |
---|---|
date | Thu, 20 Dec 2001 18:59:32 +0000 |
parents | 809d8f73caaf |
children | 55e461345aba |
comparison
equal
deleted
inserted
replaced
42204:73e75f765479 | 42205:7308bbc423d5 |
---|---|
945 (if (y-or-n-p "Another game ") | 945 (if (y-or-n-p "Another game ") |
946 (gomoku gomoku-board-width gomoku-board-height) | 946 (gomoku gomoku-board-width gomoku-board-height) |
947 (message "Chicken !"))) | 947 (message "Chicken !"))) |
948 | 948 |
949 (defun gomoku-offer-a-draw () | 949 (defun gomoku-offer-a-draw () |
950 "Offer a draw and return T if Human accepted it." | 950 "Offer a draw and return t if Human accepted it." |
951 (or (y-or-n-p "I offer you a draw. Do you accept it ") | 951 (or (y-or-n-p "I offer you a draw. Do you accept it ") |
952 (not (setq gomoku-human-refused-draw t)))) | 952 (not (setq gomoku-human-refused-draw t)))) |
953 | 953 |
954 ;;; | 954 ;;; |
955 ;;; DISPLAYING THE BOARD. | 955 ;;; DISPLAYING THE BOARD. |
1093 ;; corresponding squares. One problem is that the program does not know which | 1093 ;; corresponding squares. One problem is that the program does not know which |
1094 ;; squares ! It only knows the square where the last move has been played and | 1094 ;; squares ! It only knows the square where the last move has been played and |
1095 ;; who won. The solution is to scan the board along all four directions. | 1095 ;; who won. The solution is to scan the board along all four directions. |
1096 | 1096 |
1097 (defun gomoku-find-filled-qtuple (square value) | 1097 (defun gomoku-find-filled-qtuple (square value) |
1098 "Return T if SQUARE belongs to a qtuple filled with VALUEs." | 1098 "Return t if SQUARE belongs to a qtuple filled with VALUEs." |
1099 (or (gomoku-check-filled-qtuple square value 1 0) | 1099 (or (gomoku-check-filled-qtuple square value 1 0) |
1100 (gomoku-check-filled-qtuple square value 0 1) | 1100 (gomoku-check-filled-qtuple square value 0 1) |
1101 (gomoku-check-filled-qtuple square value 1 1) | 1101 (gomoku-check-filled-qtuple square value 1 1) |
1102 (gomoku-check-filled-qtuple square value -1 1))) | 1102 (gomoku-check-filled-qtuple square value -1 1))) |
1103 | 1103 |
1104 (defun gomoku-check-filled-qtuple (square value dx dy) | 1104 (defun gomoku-check-filled-qtuple (square value dx dy) |
1105 "Return T if SQUARE belongs to a qtuple filled with VALUEs along DX, DY." | 1105 "Return t if SQUARE belongs to a qtuple filled with VALUEs along DX, DY." |
1106 (let ((a 0) (b 0) | 1106 (let ((a 0) (b 0) |
1107 (left square) (right square) | 1107 (left square) (right square) |
1108 (depl (gomoku-xy-to-index dx dy))) | 1108 (depl (gomoku-xy-to-index dx dy))) |
1109 (while (and (> a -4) ; stretch tuple left | 1109 (while (and (> a -4) ; stretch tuple left |
1110 (= value (aref gomoku-board (setq left (- left depl))))) | 1110 (= value (aref gomoku-board (setq left (- left depl))))) |