diff lisp/play/mpuz.el @ 75669:6986faa706ca

(mpuz-random-puzzle): Fix potential lockup when `mpuz-allow-double-multiplicator' is non-zero, and correct calculation of `min'.
author David Kastrup <dak@gnu.org>
date Sun, 04 Feb 2007 17:29:50 +0000
parents e3694f1cb928
children 527f752989fc 52a7f3f50b89
line wrap: on
line diff
--- a/lisp/play/mpuz.el	Sun Feb 04 16:02:32 2007 +0000
+++ b/lisp/play/mpuz.el	Sun Feb 04 17:29:50 2007 +0000
@@ -262,8 +262,9 @@
   (fillarray mpuz-board nil)		; erase the board
   ;; A,B,C,D & E, are the five rows of our multiplication.
   ;; Choose random values, discarding cases with leading zeros in C or D.
-  (let* ((A (+ 112 (random 888)))
-	 (min (1+ (/ 1000 A)))
+  (let* ((A (if mpuz-allow-double-multiplicator (+ 112 (random 888))
+	      (+ 125 (random 875))))
+	 (min (1+ (/ 999 A)))
 	 (B1 (+ min (random (- 10 min))))
 	 B2 C D E)
     (while (if (= B1 (setq B2 (+ min (random (- 10 min)))))