diff options
| author | Glenn Morris | 2010-11-02 20:30:37 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-11-02 20:30:37 -0700 |
| commit | 033862d125d7cda856d4450228a3b28121eecc87 (patch) | |
| tree | 048e787049610986b455034672b91401b4aa81e5 | |
| parent | b9829b58cee70cc90c3cacc65c5534d034cbfd4b (diff) | |
| download | emacs-033862d125d7cda856d4450228a3b28121eecc87.tar.gz emacs-033862d125d7cda856d4450228a3b28121eecc87.zip | |
Silence compilation of gomoku.el.
* lisp/play/gomoku.el (nil-score, Xscore, XXscore, XXXscore, XXXXscore)
(Oscore, OOscore, OOOscore, OOOOscore): Rename with gomoku- prefix.
(gomoku-score-trans-table, gomoku-winning-threshold)
(gomoku-loosing-threshold, gomoku-init-score-table): Use new names.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/play/gomoku.el | 44 |
2 files changed, 29 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7eef58d6401..f72a5040edf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-11-03 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * play/gomoku.el (nil-score, Xscore, XXscore, XXXscore, XXXXscore) | ||
| 4 | (Oscore, OOscore, OOOscore, OOOOscore): Rename with gomoku- prefix. | ||
| 5 | (gomoku-score-trans-table, gomoku-winning-threshold) | ||
| 6 | (gomoku-loosing-threshold, gomoku-init-score-table): Use new names. | ||
| 7 | |||
| 1 | 2010-11-03 Chong Yidong <cyd@stupidchicken.com> | 8 | 2010-11-03 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 9 | ||
| 3 | * emacs-lisp/package.el: Don't put built-in packages in | 10 | * emacs-lisp/package.el: Don't put built-in packages in |
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index bb77c5a33ea..c6d66bb1774 100644 --- a/lisp/play/gomoku.el +++ b/lisp/play/gomoku.el | |||
| @@ -299,15 +299,15 @@ Other useful commands:\n | |||
| 299 | ;; these values will change (hopefully improve) the strength of the program | 299 | ;; these values will change (hopefully improve) the strength of the program |
| 300 | ;; and may change its style (rather aggressive here). | 300 | ;; and may change its style (rather aggressive here). |
| 301 | 301 | ||
| 302 | (defconst nil-score 7 "Score of an empty qtuple.") | 302 | (defconst gomoku-nil-score 7 "Score of an empty qtuple.") |
| 303 | (defconst Xscore 15 "Score of a qtuple containing one X.") | 303 | (defconst gomoku-Xscore 15 "Score of a qtuple containing one X.") |
| 304 | (defconst XXscore 400 "Score of a qtuple containing two X's.") | 304 | (defconst gomoku-XXscore 400 "Score of a qtuple containing two X's.") |
| 305 | (defconst XXXscore 1800 "Score of a qtuple containing three X's.") | 305 | (defconst gomoku-XXXscore 1800 "Score of a qtuple containing three X's.") |
| 306 | (defconst XXXXscore 100000 "Score of a qtuple containing four X's.") | 306 | (defconst gomoku-XXXXscore 100000 "Score of a qtuple containing four X's.") |
| 307 | (defconst Oscore 35 "Score of a qtuple containing one O.") | 307 | (defconst gomoku-Oscore 35 "Score of a qtuple containing one O.") |
| 308 | (defconst OOscore 800 "Score of a qtuple containing two O's.") | 308 | (defconst gomoku-OOscore 800 "Score of a qtuple containing two O's.") |
| 309 | (defconst OOOscore 15000 "Score of a qtuple containing three O's.") | 309 | (defconst gomoku-OOOscore 15000 "Score of a qtuple containing three O's.") |
| 310 | (defconst OOOOscore 800000 "Score of a qtuple containing four O's.") | 310 | (defconst gomoku-OOOOscore 800000 "Score of a qtuple containing four O's.") |
| 311 | 311 | ||
| 312 | ;; These values are not just random: if, given the following situation: | 312 | ;; These values are not just random: if, given the following situation: |
| 313 | ;; | 313 | ;; |
| @@ -320,7 +320,7 @@ Other useful commands:\n | |||
| 320 | ;; you want Emacs to play in "a" and not in "b", then the parameters must | 320 | ;; you want Emacs to play in "a" and not in "b", then the parameters must |
| 321 | ;; satisfy the inequality: | 321 | ;; satisfy the inequality: |
| 322 | ;; | 322 | ;; |
| 323 | ;; 6 * XXscore > XXXscore + XXscore | 323 | ;; 6 * gomoku-XXscore > gomoku-XXXscore + gomoku-XXscore |
| 324 | ;; | 324 | ;; |
| 325 | ;; because "a" mainly belongs to six "XX" qtuples (the others are less | 325 | ;; because "a" mainly belongs to six "XX" qtuples (the others are less |
| 326 | ;; important) while "b" belongs to one "XXX" and one "XX" qtuples. Other | 326 | ;; important) while "b" belongs to one "XXX" and one "XX" qtuples. Other |
| @@ -334,26 +334,26 @@ Other useful commands:\n | |||
| 334 | ;; we just have to set up a translation table. | 334 | ;; we just have to set up a translation table. |
| 335 | 335 | ||
| 336 | (defconst gomoku-score-trans-table | 336 | (defconst gomoku-score-trans-table |
| 337 | (vector nil-score Xscore XXscore XXXscore XXXXscore 0 | 337 | (vector gomoku-nil-score gomoku-Xscore gomoku-XXscore gomoku-XXXscore gomoku-XXXXscore 0 |
| 338 | Oscore 0 0 0 0 0 | 338 | gomoku-Oscore 0 0 0 0 0 |
| 339 | OOscore 0 0 0 0 0 | 339 | gomoku-OOscore 0 0 0 0 0 |
| 340 | OOOscore 0 0 0 0 0 | 340 | gomoku-OOOscore 0 0 0 0 0 |
| 341 | OOOOscore 0 0 0 0 0 | 341 | gomoku-OOOOscore 0 0 0 0 0 |
| 342 | 0) | 342 | 0) |
| 343 | "Vector associating qtuple contents to their score.") | 343 | "Vector associating qtuple contents to their score.") |
| 344 | 344 | ||
| 345 | 345 | ||
| 346 | ;; If you do not modify drastically the previous constants, the only way for a | 346 | ;; If you do not modify drastically the previous constants, the only way for a |
| 347 | ;; square to have a score higher than OOOOscore is to belong to a "OOOO" | 347 | ;; square to have a score higher than gomoku-OOOOscore is to belong to a "OOOO" |
| 348 | ;; qtuple, thus to be a winning move. Similarly, the only way for a square to | 348 | ;; qtuple, thus to be a winning move. Similarly, the only way for a square to |
| 349 | ;; have a score between XXXXscore and OOOOscore is to belong to a "XXXX" | 349 | ;; have a score between gomoku-XXXXscore and gomoku-OOOOscore is to belong to a "XXXX" |
| 350 | ;; qtuple. We may use these considerations to detect when a given move is | 350 | ;; qtuple. We may use these considerations to detect when a given move is |
| 351 | ;; winning or loosing. | 351 | ;; winning or loosing. |
| 352 | 352 | ||
| 353 | (defconst gomoku-winning-threshold OOOOscore | 353 | (defconst gomoku-winning-threshold gomoku-OOOOscore |
| 354 | "Threshold score beyond which an Emacs move is winning.") | 354 | "Threshold score beyond which an Emacs move is winning.") |
| 355 | 355 | ||
| 356 | (defconst gomoku-loosing-threshold XXXXscore | 356 | (defconst gomoku-loosing-threshold gomoku-XXXXscore |
| 357 | "Threshold score beyond which a human move is winning.") | 357 | "Threshold score beyond which a human move is winning.") |
| 358 | 358 | ||
| 359 | 359 | ||
| @@ -394,10 +394,10 @@ Other useful commands:\n | |||
| 394 | ;;; | 394 | ;;; |
| 395 | 395 | ||
| 396 | ;; At initialization the board is empty so that every qtuple amounts for | 396 | ;; At initialization the board is empty so that every qtuple amounts for |
| 397 | ;; nil-score. Therefore, the score of any square is nil-score times the number | 397 | ;; gomoku-nil-score. Therefore, the score of any square is gomoku-nil-score times the number |
| 398 | ;; of qtuples that pass through it. This number is 3 in a corner and 20 if you | 398 | ;; of qtuples that pass through it. This number is 3 in a corner and 20 if you |
| 399 | ;; are sufficiently far from the sides. As computing the number is time | 399 | ;; are sufficiently far from the sides. As computing the number is time |
| 400 | ;; consuming, we initialize every square with 20*nil-score and then only | 400 | ;; consuming, we initialize every square with 20*gomoku-nil-score and then only |
| 401 | ;; consider squares at less than 5 squares from one side. We speed this up by | 401 | ;; consider squares at less than 5 squares from one side. We speed this up by |
| 402 | ;; taking symmetry into account. | 402 | ;; taking symmetry into account. |
| 403 | ;; Also, as it is likely that successive games will be played on a board with | 403 | ;; Also, as it is likely that successive games will be played on a board with |
| @@ -421,7 +421,7 @@ Other useful commands:\n | |||
| 421 | (setq gomoku-score-table (copy-sequence gomoku-saved-score-table)) | 421 | (setq gomoku-score-table (copy-sequence gomoku-saved-score-table)) |
| 422 | ;; No, compute it: | 422 | ;; No, compute it: |
| 423 | (setq gomoku-score-table | 423 | (setq gomoku-score-table |
| 424 | (make-vector gomoku-vector-length (* 20 nil-score))) | 424 | (make-vector gomoku-vector-length (* 20 gomoku-nil-score))) |
| 425 | (let (i j maxi maxj maxi2 maxj2) | 425 | (let (i j maxi maxj maxi2 maxj2) |
| 426 | (setq maxi (/ (1+ gomoku-board-width) 2) | 426 | (setq maxi (/ (1+ gomoku-board-width) 2) |
| 427 | maxj (/ (1+ gomoku-board-height) 2) | 427 | maxj (/ (1+ gomoku-board-height) 2) |