Commits

zck  committed c7a9210

make 'neighbors return a list of lists, not a list of cons cells.

  • Participants
  • Parent commits 246cdd1

Comments (0)

Files changed (1)

File minesweeper.el

 (defun minesweeper-inform-around (row col &optional amount)
   "takes in a square, and increases the values of all its empty neighbors by 'amount"
   (mapc (lambda (position)
-	  (minesweeper-++ (car position) (cdr position) amount))
+	  (minesweeper-++ (car position) (cadr position) amount))
 	(minesweeper-neighbors row col)))
 
 (defun minesweeper-++ (row col &optional amount)
 				      (min (1+ row) (1- *minesweeper-board-height*))
 				      (when (not (and (eq newcol col)
 						      (eq newrow row)))
-					(push (cons newrow newcol)
+					(push (list newrow newcol)
 					      neighbors))))
     neighbors))
 
       (if (eq val ?X)
 	  (progn (minesweeper-lose-game row col)
 		 (throw 'game-end nil))
-	(let ((to-reveal (list (cons row col))))
+	(let ((to-reveal (list (list row col))))
 	  (minesweeper-debug "The user didn't pick an X")
 	  (while to-reveal
 	    (let* ((cur (pop to-reveal))
 		   (cur-row (car cur))
-		   (cur-col (cdr cur)))
+		   (cur-col (cadr cur)))
 	      (minesweeper-debug "View-mine says " (number-to-string cur-col) ", " (number-to-string cur-row) " mine = " (make-string 1 (minesweeper-view-mine cur-row cur-col 't)))
 	      (unless (or (minesweeper-is-revealed cur-row cur-col)
 			  (minesweeper-marked cur-row cur-col))
   (when (minesweeper-neighbors-bounds row col)
     (mapc '(lambda (position)
 	     (minesweeper-debug "called pick-around-helper " (number-to-string col) " " (number-to-string row))
-	     (minesweeper-pick (car position) (cdr position)))
+	     (minesweeper-pick (car position) (cadr position)))
 	  (minesweeper-neighbors row col))))
 
 (defun minesweeper-lose-game (row col)