zck  committed 246cdd1

made 'neighbors return a list of (rol col) positions, not (col row) ones.

  • Participants
  • Parent commits ba0d631
  • Branches default

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-++ (cdr position) (car position) amount))
+	  (minesweeper-++ (car position) (cdr position) amount))
 	(minesweeper-neighbors row col)))
 (defun minesweeper-++ (row col &optional amount)
 			       (or amount 1))))))
 (defun minesweeper-neighbors (row col)
-  "Returns a list of the neighbors of (col, row)."
+  "Returns a list of the neighbors of (row, col)."
   (let ((neighbors nil))
     (minesweeper-for newcol
 		     (max (1- col) 0)
 				      (min (1+ row) (1- *minesweeper-board-height*))
 				      (when (not (and (eq newcol col)
 						      (eq newrow row)))
-					(push (cons newcol newrow)
+					(push (cons newrow newcol)
       (if (eq val ?X)
 	  (progn (minesweeper-lose-game row col)
 		 (throw 'game-end nil))
-	(let ((to-reveal (list (cons col row))))
+	(let ((to-reveal (list (cons row col))))
 	  (minesweeper-debug "The user didn't pick an X")
 	  (while to-reveal
 	    (let* ((cur (pop to-reveal))
-		   (cur-col (car cur))
-		   (cur-row (cdr cur)))
+		   (cur-row (car cur))
+		   (cur-col (cdr 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 (cdr position) (car position)))
+	     (minesweeper-pick (car position) (cdr position)))
 	  (minesweeper-neighbors row col))))
 (defun minesweeper-lose-game (row col)