changeset 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 5181776fdb93
children 098e6a6c51ca
files lisp/ChangeLog lisp/play/mpuz.el
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 04 16:02:32 2007 +0000
+++ b/lisp/ChangeLog	Sun Feb 04 17:29:50 2007 +0000
@@ -1,3 +1,9 @@
+2007-02-04  David Kastrup  <dak@gnu.org>
+
+	* play/mpuz.el (mpuz-random-puzzle): Fix potential lockup when
+	`mpuz-allow-double-multiplicator' is non-zero, and correct
+	calculation of `min'.
+
 2007-02-04  Per Abrahamsen  <abraham@dina.kvl.dk>
 
 	* wid-edit.el (widget-default-create): Insert new text at the
--- 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)))))