File: gomoku.el.html
RULES:
Gomoku is a game played between two players on a rectangular board. Each player, in turn, marks a free square of its choice. The winner is the first one to mark five contiguous squares in any direction (horizontally, vertically or diagonally).
I have been told that, in "The TRUE Gomoku", some restrictions are made about the squares where one may play, or else there is a known forced win for the first player. This program has no such restriction, but it does not know about the forced win, nor do I. See https://renju.se/rif/r1rulhis.htm for more information.
There are two main places where you may want to customize the program: key bindings and board display. These features are commented in the code. Go and see.
HOW TO USE:
The command M-x gomoku displays a board, the size of which depends on the
size of the current window. The size of the board is easily modified by
giving numeric arguments to the gomoku command and/or by customizing the
displaying parameters.
Emacs plays when it is its turn. When it is your turn, just put the cursor
on the square where you want to play and hit RET, or X, or whatever key you
bind to the command gomoku-human-plays. When it is your turn, Emacs is
idle: you may switch buffers, read your mail, ... Just come back to the
*Gomoku* buffer and resume play.
ALGORITHM:
The algorithm is briefly described in section "THE SCORE TABLE". Some parameters may be modified if you want to change the style exhibited by the program.
Defined variables (43)
gomoku-OOOOscore | Score of a qtuple containing four O’s. |
gomoku-OOOscore | Score of a qtuple containing three O’s. |
gomoku-OOscore | Score of a qtuple containing two O’s. |
gomoku-Oscore | Score of a qtuple containing one O. |
gomoku-XXXXscore | Score of a qtuple containing four X’s. |
gomoku-XXXscore | Score of a qtuple containing three X’s. |
gomoku-XXscore | Score of a qtuple containing two X’s. |
gomoku-Xscore | Score of a qtuple containing one X. |
gomoku-board | Vector recording the actual state of the Gomoku board. |
gomoku-board-height | Number of lines on the Gomoku board. |
gomoku-board-width | Number of columns on the Gomoku board. |
gomoku-buffer-name | Name of the Gomoku buffer. |
gomoku-draw-limit | After how many moves will Emacs offer a draw? |
gomoku-emacs-is-computing | Non-nil if Emacs is in the middle of a computation. |
gomoku-emacs-played-first | Non-nil if Emacs played first. |
gomoku-emacs-won | For making font-lock use the winner’s face for the line. |
gomoku-font-lock-keywords | Font lock rules for Gomoku. |
gomoku-game-history | A record of all moves that have been played during current game. |
gomoku-game-in-progress | Non-nil if a game is in progress. |
gomoku-human-refused-draw | Non-nil if Human refused Emacs offer of a draw. |
gomoku-human-took-back | Non-nil if Human took back a move during the game. |
gomoku-losing-threshold | Threshold score beyond which a human move is winning. |
gomoku-mode-abbrev-table | Abbrev table for ‘gomoku-mode’. |
gomoku-mode-hook | If non-nil, its value is called on entry to Gomoku mode. |
gomoku-mode-map | Local keymap to use in Gomoku mode. |
gomoku-mode-syntax-table | Syntax table for ‘gomoku-mode’. |
gomoku-nil-score | Score of an empty qtuple. |
gomoku-number-of-draws | Number of games already drawn in this session. |
gomoku-number-of-emacs-wins | Number of games Emacs won in this session. |
gomoku-number-of-human-moves | Number of moves already played by human in current game. |
gomoku-number-of-human-wins | Number of games you won in this session. |
gomoku-number-of-moves | Number of moves already played in current game. |
gomoku-saved-board-height | Recorded value of previous board height. |
gomoku-saved-board-width | Recorded value of previous board width. |
gomoku-saved-score-table | Recorded initial value of previous score table. |
gomoku-score-table | Vector recording the actual score of the free squares. |
gomoku-score-trans-table | Vector associating qtuple contents to their score. |
gomoku-square-height | Vertical spacing between squares on the Gomoku board. |
gomoku-square-width | Horizontal spacing between squares on the Gomoku board. |
gomoku-vector-length | Length of ‘gomoku-board’ vector. |
gomoku-winning-threshold | Threshold score beyond which an Emacs move is winning. |
gomoku-x-offset | Number of columns between the Gomoku board and the side of the window. |
gomoku-y-offset | Number of lines between the Gomoku board and the top of the window. |