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

Lines Matching defs:board

75 ;; The board is a rectangular grid. We code empty squares with 0, X's with 1
78 ;; detect when we are trying to move out of the board. We denote a square by
80 ;; leftmost topmost square has coords (1,1) and index lm-board-width + 2.
84 (defvar lm-board-width nil
85 "Number of columns on the Lm board.")
86 (defvar lm-board-height nil
87 "Number of lines on the Lm board.")
89 (defvar lm-board nil
90 "Vector recording the actual state of the Lm board.")
93 "Length of lm-board vector.")
100 "This is the x coordinate of the center of the board.")
103 "This is the y coordinate of the center of the board.")
106 "This is the x dimension of the playing board.")
109 "This is the y dimension of the playing board.")
113 "Translate X, Y cartesian coords into the corresponding board index."
114 (+ (* y lm-board-width) x y))
117 "Return corresponding x-coord of board INDEX."
118 (% index (1+ lm-board-width)))
121 "Return corresponding y-coord of board INDEX."
122 (/ index (1+ lm-board-width)))
124 (defun lm-init-board ()
125 "Create the lm-board vector and fill it with initial values."
126 (setq lm-board (make-vector lm-vector-length 0))
129 (while (<= i lm-board-width) ; The squares in [0..width] and in
130 (aset lm-board i -1) ; [length - width - 1..length - 1]
131 (aset lm-board ii -1) ; are padding squares.
136 (aset lm-board i -1) ; and also all k*(width+1)
137 (setq i (+ i lm-board-width 1)))))
145 "*Horizontal spacing between squares on the Lm board.")
148 "*Vertical spacing between squares on the Lm board.")
151 "*Number of columns between the Lm board and the side of the window.")
154 "*Number of lines between the Lm board and the top of the window.")
277 ;; the board as just a set of squares, we prefer to see it as a "space" of
293 ;; board is just the sum of the scores of all the qtuples to which it belongs,
376 (end (lm-xy-to-index lm-board-width lm-board-height))
384 (if (zerop (aref lm-board square)) ; is it free ?
390 ((not (zerop (aref lm-board square)))
400 ;; At initialization the board is empty so that every qtuple amounts for
407 ;; Also, as it is likely that successive games will be played on a board with
413 (defvar lm-saved-board-width nil
414 "Recorded value of previous board width.")
416 (defvar lm-saved-board-height nil
417 "Recorded value of previous board height.")
423 (= lm-board-width lm-saved-board-width)
424 (= lm-board-height lm-saved-board-height))
430 (setq maxi (/ (1+ lm-board-width) 2)
431 maxj (/ (1+ lm-board-height) 2)
434 ;; We took symmetry into account and could use it more if the board
438 ;; board may well be less than 8 by 8 !
453 lm-saved-board-width lm-board-width
454 lm-saved-board-height lm-board-height)))
462 (right (min 4 (- lm-board-width i)))
464 (down (min 4 (- lm-board-height j))))
473 (let ((ii (1+ (- lm-board-width i)))
474 (jj (1+ (- lm-board-height j)))
485 ;; proportional to the size of the board. It is better to update the
491 ;; The board has already been updated when this function is called.
501 (imax (min 0 (- lm-board-width x 4)))
502 (jmax (min 0 (- lm-board-height y 4))))
510 (- x lm-board-width))
512 (- lm-board-height y 4))
534 (setq count (+ count (aref lm-board square))
544 (if (zerop (aref lm-board square)) ; only for free squares
551 count (+ count (- (aref lm-board square0))
552 (aref lm-board square2))
591 "Initialize a new game on an N by M board."
594 (setq lm-board-width n
595 lm-board-height m
607 (lm-init-board) ; table be already created.
622 (aset lm-board square val) ; *BEFORE* UPDATE-SCORE !
633 (oldval (aref lm-board square)))
639 (aset lm-board square 0) ; *BEFORE* UPDATE-SCORE !
734 lm-board-width)
745 lm-board-height))))
769 ((not (zerop (aref lm-board square)))
849 "Largest possible board width for the current window."
855 "Largest possible board height for the current window."
862 "Return the board row where point is."
907 "Display an N by M Lm board."
955 (lm-goto-xy (/ (1+ n) 2) (/ (1+ m) 2)) ; center of the board
987 ;; who won. The solution is to scan the board along all four directions.
1002 (= value (aref lm-board (setq left (- left depl)))))
1005 (= value (aref lm-board (setq right (+ right depl)))))
1052 "Move point down one row on the Lm board."
1054 (if (< (lm-point-y) lm-board-height)
1058 "Move point up one row on the Lm board."
1064 "Move point North East on the Lm board."
1070 "Move point South East on the Lm board."
1076 "Move point North West on the Lm board."
1082 "Move point South West on the Lm board."
1088 "Move point to first square on the Lm board row."
1093 "Move point to last square on the Lm board row."
1096 (* lm-square-width (1- lm-board-width)))))
1129 "If non-nil, print \"One moment please\" when a new board is generated.
1328 (setq lm-cx (/ lm-board-width 2))
1329 (setq lm-cy (/ lm-board-height 2))
1340 (put 'lm-s 'y lm-board-height)
1344 (put 'lm-w 'y (/ lm-board-height 2))
1347 (put 'lm-e 'x lm-board-width)
1348 (put 'lm-e 'y (/ lm-board-height 2))
1529 ((not (zerop (aref lm-board square)))
1593 (lm-goto-xy (1+ (random lm-board-width)) (1+ (random lm-board-height)))
1681 (not (eq lm-m lm-saved-board-height))