From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Vincent_Bela=EFche?= Newsgroups: gmane.emacs.devel Subject: 5x5 again Date: Tue, 24 May 2011 07:08:20 +0200 Message-ID: <80lixwr8hn.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1306213725 6420 80.91.229.12 (24 May 2011 05:08:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 05:08:45 +0000 (UTC) Cc: =?iso-8859-1?Q?Vincent_Bela=EFche?= To: emacs-devel@gnu.org , Stefan Monnier , Jay P Belanger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 24 07:08:40 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOjrD-0002L5-CF for ged-emacs-devel@m.gmane.org; Tue, 24 May 2011 07:08:39 +0200 Original-Received: from localhost ([::1]:54363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOjrC-0007fw-36 for ged-emacs-devel@m.gmane.org; Tue, 24 May 2011 01:08:38 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOjr9-0007ff-7H for emacs-devel@gnu.org; Tue, 24 May 2011 01:08:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOjr7-0003uJ-NY for emacs-devel@gnu.org; Tue, 24 May 2011 01:08:35 -0400 Original-Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:33210 helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOjr7-0003uF-EP for emacs-devel@gnu.org; Tue, 24 May 2011 01:08:33 -0400 Original-Received: from CHOUNEK ([92.135.118.85]) by mwinf5d33 with ME id nH8V1g00A1qe6Tg03H8W9U; Tue, 24 May 2011 07:08:31 +0200 X-Antivirus: avast! (VPS 110523-1, 23/05/2011), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.12.242.132 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139671 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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=EFche * 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 =3D 5. So they may be useful again to design a more generic solution. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=5x5.el.diff === 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))) --=-=-=--