Function: landmark-update-score-in-direction
landmark-update-score-in-direction is a byte-compiled function defined
in landmark.el.gz.
Signature
(landmark-update-score-in-direction LEFT RIGHT SQUARE DX DY DVAL)
Documentation
Update scores for all squares in the qtuples in range.
That is, those between the LEFTth square and the RIGHTth after SQUARE, along the DX, DY direction, considering that DVAL has been added on SQUARE.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/landmark.el.gz
(defun landmark-update-score-in-direction (left right square dx dy dval)
"Update scores for all squares in the qtuples in range.
That is, those between the LEFTth square and the RIGHTth after SQUARE,
along the DX, DY direction, considering that DVAL has been added on SQUARE."
;; We always have LEFT <= 0, RIGHT <= 0 and DEPL > 0 but we may very well
;; have LEFT > RIGHT, indicating that no qtuple contains SQUARE along that
;; DX,DY direction.
(cond
((> left right)) ; Quit
(t ; Else ..
(let (depl square0 square1 square2 count delta)
(setq depl (landmark-xy-to-index dx dy)
square0 (+ square (* left depl))
square1 (+ square (* right depl))
square2 (+ square0 (* 4 depl)))
;; Compute the contents of the first qtuple:
(setq square square0
count 0)
(while (<= square square2)
(setq count (+ count (aref landmark-board square))
square (+ square depl)))
(while (<= square0 square1)
;; Update the squares of the qtuple beginning in SQUARE0 and ending
;; in SQUARE2.
(setq delta (- (aref landmark-score-trans-table count)
(aref landmark-score-trans-table (- count dval))))
(cond ((not (zerop delta)) ; or else nothing to update
(setq square square0)
(while (<= square square2)
(if (zerop (aref landmark-board square)) ; only for free squares
(aset landmark-score-table square
(+ (aref landmark-score-table square) delta)))
(setq square (+ square depl)))))
;; Then shift the qtuple one square along DEPL, this only requires
;; modifying SQUARE0 and SQUARE2.
(setq square2 (+ square2 depl)
count (+ count (- (aref landmark-board square0))
(aref landmark-board square2))
square0 (+ square0 depl)))))))