unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: emacs-devel@gnu.org , Stefan Monnier <monnier@iro.umontreal.ca> ,
	Jay P Belanger <jay.p.belanger@gmail.com>
Cc: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
Subject: 5x5 again
Date: Tue, 24 May 2011 07:08:20 +0200	[thread overview]
Message-ID: <80lixwr8hn.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

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  <vincentb1@users.sourceforge.net>

	* 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.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 5x5.el.diff --]
[-- Type: text/x-patch, Size: 1239 bytes --]

=== 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)))


             reply	other threads:[~2011-05-24  5:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  5:08 Vincent Belaïche [this message]
2011-05-24 18:23 ` 5x5 again Stefan Monnier
2011-05-25  6:13   ` Vincent Belaïche
2011-05-28  1:17     ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2011-05-28  6:05 Vincent Belaïche
2011-05-30 13:40 ` Stefan Monnier
2011-05-31 19:52 Vincent Belaïche
2011-06-21  3:16 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80lixwr8hn.fsf@gmail.com \
    --to=vincent.b.1@hotmail.fr \
    --cc=emacs-devel@gnu.org \
    --cc=jay.p.belanger@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).