comparison lisp/games/mpuz.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents b82b59fe008d
children b9518feda344
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; mpuz.el --- multiplication puzzle for XEmacs 1 ;;; mpuz.el --- multiplication puzzle for XEmacs
2 2
3 ;; Copyright (C) 1990 Free Software Foundation, Inc. 3 ;;; Copyright (C) 1990 Free Software Foundation, Inc.
4 4
5 ;; Author: Philippe Schnoebelen <phs@lifia.imag.fr> 5 ;; Author: Philippe Schnoebelen <phs@lifia.imag.fr>
6 ;; Keywords: games 6 ;; Keywords: games
7 7
8 ;; This file is part of XEmacs. 8 ;; This file is part of XEmacs.
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details. 18 ;; General Public License for more details.
19 19
20 ;; You should have received a copy of the GNU General Public License 20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free 21 ;; along with XEmacs; see the file COPYING. If not, write to the
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; 02111-1307, USA. 23 ;; Boston, MA 02111-1307, USA.
24 24
25 ;;; Synched up with: FSF 19.34. 25 ;;; Synched up with: FSF 19.30.
26 26
27 ;;; Commentary: 27 ;;; Commentary:
28 28
29 ;; When this package is loaded, `M-x mpuz' generates a random multiplication 29 ;; When this package is loaded, `M-x mpuz' generates a random multiplication
30 ;; puzzle. This is a multiplication example in which each digit has been 30 ;; puzzle. This is a multiplication example in which each digit has been
186 B (random 100) 186 B (random 100)
187 C (* A (% B 10)) 187 C (* A (% B 10))
188 D (* A (/ B 10)) 188 D (* A (/ B 10))
189 E (* A B)) 189 E (* A B))
190 (or (< C 1000) (< D 1000)))) ; forbid leading zeros in C or D 190 (or (< C 1000) (< D 1000)))) ; forbid leading zeros in C or D
191 ;; Individual digits are now put on their respective squares. 191 ;; Individual digits are now put on their respectives squares.
192 ;; [NB: A square is a pair <row,column> of the screen.] 192 ;; [NB: A square is a pair <row,column> of the screen.]
193 (mpuz-put-digit-on-board A '(2 . 9)) 193 (mpuz-put-digit-on-board A '(2 . 9))
194 (mpuz-put-digit-on-board (/ A 10) '(2 . 7)) 194 (mpuz-put-digit-on-board (/ A 10) '(2 . 7))
195 (mpuz-put-digit-on-board (/ A 100) '(2 . 5)) 195 (mpuz-put-digit-on-board (/ A 100) '(2 . 5))
196 (mpuz-put-digit-on-board B '(4 . 9)) 196 (mpuz-put-digit-on-board B '(4 . 9))