Function: mpuz-check-all-solved

mpuz-check-all-solved is a byte-compiled function defined in mpuz.el.gz.

Signature

(mpuz-check-all-solved &optional ROW COL)

Documentation

Check whether all digits have been solved. Return t if yes.

Source Code

;; Defined in /usr/src/emacs/lisp/play/mpuz.el.gz
(defun mpuz-check-all-solved (&optional row col)
  "Check whether all digits have been solved.  Return t if yes."
  (catch 'solved
    (let (A B1 B2 C D E squares)
      (and mpuz-solve-when-trivial
	   (not row)
	   (while
	       (cond ((or (and (setq B1 (or B1 (mpuz-check-all-solved 4 7))
				     B2 (or B2 (mpuz-check-all-solved 4 9))
				     E (or E (mpuz-check-all-solved 10))
				     A (or A (mpuz-check-all-solved 2)))
			       B1 B2)
			  (and E (or A (and B1 B2))))
		      (mpuz-solve)
		      (mpuz-paint-board)
		      (throw 'solved t))
		     ((and (setq D (or D (mpuz-check-all-solved 8))
				 C (or C (mpuz-check-all-solved 6)))
			   D (not E))
		      (mpuz-solve 10))
		     ((and E (not (eq C D)))
		      (mpuz-solve (if D 6 8)))
		     ((and A (not (eq B2 C)))
		      (mpuz-solve (if C 4 6) (if C 9)))
		     ((and A (not (eq B1 D)))
		      (mpuz-solve (if D 4 8) (if D 7)))
		     ((and (not A) (or (and B2 C) (and B1 D)))
		      (mpuz-solve 2)))))
      (mpuz-paint-board)
      (mapc (lambda (digit)
	      (and (not (mpuz-digit-solved-p digit)) ; unsolved
		   (setq squares (aref mpuz-board digit))
		   (if row
		       (if col
			   (member (cons row col) squares)
			 (assq row squares))
		     squares) ; and appearing in the puzzle!
		   (throw 'solved nil)))
	    [0 1 2 3 4 5 6 7 8 9]))
    t))