• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/play/

Lines Matching defs:score

274 ;; Every (free) square has a score associated to it, recorded in the
276 ;; the highest score.
278 (defvar gomoku-score-table nil
279 "Vector recording the actual score of the free squares.")
288 ;; score for every qtuple, with better qtuples having better scores. Of
289 ;; course, the score of a qtuple (taken in isolation) is just determined by
291 ;; highest score is given to the "OOOO" qtuples because playing in such a
295 ;; has score zero because there is no more any point in playing in it, from
298 ;; Given the score of every qtuple, the score of a given free square on the
314 (defconst nil-score 7 "Score of an empty qtuple.")
348 (defconst gomoku-score-trans-table
349 (vector nil-score Xscore XXscore XXXscore XXXXscore 0
355 "Vector associating qtuple contents to their score.")
359 ;; square to have a score higher than OOOOscore is to belong to a "OOOO"
361 ;; have a score between XXXXscore and OOOOscore is to belong to a "XXXX"
366 "Threshold score beyond which an Emacs move is winning.")
369 "Threshold score beyond which a human move is winning.")
373 "Compute index of free square with highest score, or nil if none."
376 ;; up future searches, we set the score of padding or occupied squares
379 (let ((score-max 0)
383 best-square score)
386 ;; If score is lower (i.e. most of the time), skip to next:
387 ((< (aref gomoku-score-table square) score-max))
388 ;; If score is better, beware of non free squares:
389 ((> (setq score (aref gomoku-score-table square)) score-max)
393 score-max score)
394 (aset gomoku-score-table square -1))) ; no: kill it !
395 ;; If score is equally good, choose randomly. But first check freeness:
397 (aset gomoku-score-table square -1))
400 score-max score)))
410 ;; nil-score. Therefore, the score of any square is nil-score times the number
413 ;; consuming, we initialize every square with 20*nil-score and then only
419 (defvar gomoku-saved-score-table nil
420 "Recorded initial value of previous score table.")
429 (defun gomoku-init-score-table ()
430 "Create the score table vector and fill it with initial values."
431 (if (and gomoku-saved-score-table ; Has it been stored last time ?
434 (setq gomoku-score-table (copy-sequence gomoku-saved-score-table))
436 (setq gomoku-score-table
437 (make-vector gomoku-vector-length (* 20 nil-score)))
452 (gomoku-init-square-score i j)
458 (gomoku-init-square-score i j)
461 (setq gomoku-saved-score-table (copy-sequence gomoku-score-table)
480 (defun gomoku-init-square-score (i j)
481 "Give initial score to square I,J and to its mirror images."
484 (sc (* (gomoku-nb-qtuples i j) (aref gomoku-score-trans-table 0))))
485 (aset gomoku-score-table (gomoku-xy-to-index i j) sc)
486 (aset gomoku-score-table (gomoku-xy-to-index ii j) sc)
487 (aset gomoku-score-table (gomoku-xy-to-index i jj) sc)
488 (aset gomoku-score-table (gomoku-xy-to-index ii jj) sc)))
501 (defun gomoku-update-score-table (square dval)
502 "Update score table after SQUARE received a DVAL increment."
505 ;; directions and then calling update-score-in-direction.
508 ;; its score had been set to -1 at the time.
515 (gomoku-update-score-in-direction imin imax
517 (gomoku-update-score-in-direction jmin jmax
519 (gomoku-update-score-in-direction (max imin jmin) (min imax jmax)
521 (gomoku-update-score-in-direction (max (- 1 y) -4
527 (defun gomoku-update-score-in-direction (left right square dx dy dval)
551 (setq delta (- (aref gomoku-score-trans-table count)
552 (aref gomoku-score-trans-table (- count dval))))
557 (aset gomoku-score-table square
558 (+ (aref gomoku-score-table square) delta)))
574 ;; (anti-updating the score table) and to compute the table from scratch in
619 (gomoku-init-score-table) ; INIT-BOARD requires that the score
623 (defun gomoku-play-move (square val &optional dont-update-score)
631 (cons (cons square (aref gomoku-score-table square))
636 (if dont-update-score nil
637 (gomoku-update-score-table square val) ; previous val was 0: dval = val
638 (aset gomoku-score-table square -1))
653 (gomoku-update-score-table square (- oldval))
654 (aset gomoku-score-table square (cdr last-move)))
813 (let (square score)
818 (setq score (aref gomoku-score-table square))
820 (cond ((>= score gomoku-winning-threshold)
824 ((zerop score)
883 (let (square score)
890 (setq score (aref gomoku-score-table square))
892 (cond ((and (>= score gomoku-loosing-threshold)