[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
5x5 again
From: |
Vincent Belaïche |
Subject: |
5x5 again |
Date: |
Tue, 24 May 2011 07:08:20 +0200 |
Hello,
Sorry to dwell on it. But I just realized that my contribution does not
work correctly when the code is compiled. I also corrected by the way a
bug --- the solution display was not cleaned out along with the other
game variables in case that a new game is stated.
Here follows the Changelog and the patch. Sorry for the extra
disturbance.
Vincent.
2011-05-24 Vincent Belaïche <address@hidden>
* play/5x5.el (5x5-new-game, 5x5-randomize): reset
5x5-solver-output to nil when a new grid is cast.
(5x5-log-init, 5x5-log): use defsubst instead of defmacro to shunt
these debugging traces, as defmacro breaks the compiled code. Note
these logging facilities were not cleaned out as the aritmetic
solver is not yet complete --- it works only for grid size = 5. So
they may be useful again to design a more generic solution.
=== modified file 'lisp/play/5x5.el'
--- lisp/play/5x5.el 2011-05-23 14:46:41 +0000
+++ lisp/play/5x5.el 2011-05-24 04:53:57 +0000
@@ -239,7 +239,8 @@
(setq 5x5-x-pos (/ 5x5-grid-size 2)
5x5-y-pos (/ 5x5-grid-size 2)
5x5-moves 0
- 5x5-grid (5x5-make-move (5x5-make-new-grid) 5x5-y-pos 5x5-x-pos))
+ 5x5-grid (5x5-make-move (5x5-make-new-grid) 5x5-y-pos 5x5-x-pos)
+ 5x5-solver-output nil)
(5x5-draw-grid (list 5x5-grid))
(5x5-position-cursor)))
@@ -515,8 +516,8 @@
(with-current-buffer 5x5-log-buffer
(insert name ?= value-to-log ?\n))))
value))
- (defmacro 5x5-log-init ())
- (defmacro 5x5-log (name value) value))
+ (defsubst 5x5-log-init ())
+ (defsubst 5x5-log (name value) value))
(defun 5x5-solver (grid)
"Return a list of solutions for GRID.
@@ -843,7 +844,8 @@
(setq 5x5-x-pos (/ 5x5-grid-size 2)
5x5-y-pos (/ 5x5-grid-size 2)
5x5-moves 0
- 5x5-grid (5x5-make-random-grid (symbol-function '5x5-make-move)))
+ 5x5-grid (5x5-make-random-grid (symbol-function '5x5-make-move))
+ 5x5-solver-output nil)
(unless 5x5-cracking
(5x5-draw-grid (list 5x5-grid)))
(5x5-position-cursor)))
- 5x5 again,
Vincent Belaïche <=