Function: landmark-update-score-table
landmark-update-score-table is a byte-compiled function defined in
landmark.el.gz.
Signature
(landmark-update-score-table SQUARE DVAL)
Documentation
Update score table after SQUARE received a DVAL increment.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/landmark.el.gz
;;;_ - MAINTAINING THE SCORE TABLE.
;; We do not provide functions for computing the SCORE-TABLE given the
;; contents of the BOARD. This would involve heavy nested loops, with time
;; proportional to the size of the board. It is better to update the
;; SCORE-TABLE after each move. Updating needs not modify more than 36
;; squares: it is done in constant time.
(defun landmark-update-score-table (square dval)
"Update score table after SQUARE received a DVAL increment."
;; The board has already been updated when this function is called.
;; Updating scores is done by looking for qtuples boundaries in all four
;; directions and then calling update-score-in-direction.
;; Finally all squares received the right increment, and then are up to
;; date, except possibly for SQUARE itself if we are taking a move back for
;; its score had been set to -1 at the time.
(let* ((x (landmark-index-to-x square))
(y (landmark-index-to-y square))
(imin (max -4 (- 1 x)))
(jmin (max -4 (- 1 y)))
(imax (min 0 (- landmark-board-width x 4)))
(jmax (min 0 (- landmark-board-height y 4))))
(landmark-update-score-in-direction imin imax
square 1 0 dval)
(landmark-update-score-in-direction jmin jmax
square 0 1 dval)
(landmark-update-score-in-direction (max imin jmin) (min imax jmax)
square 1 1 dval)
(landmark-update-score-in-direction (max (- 1 y) -4
(- x landmark-board-width))
(min 0 (- x 5)
(- landmark-board-height y 4))
square -1 1 dval)))