From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Randomise spawning apples in snake.el Date: Wed, 19 Aug 2009 16:05:41 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250712362 16773 80.91.229.12 (19 Aug 2009 20:06:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Aug 2009 20:06:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stuart Hacking Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 19 22:05:55 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MdrPt-0003cG-6S for ged-emacs-devel@m.gmane.org; Wed, 19 Aug 2009 22:05:53 +0200 Original-Received: from localhost ([127.0.0.1]:42418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdrPs-0006Y7-NV for ged-emacs-devel@m.gmane.org; Wed, 19 Aug 2009 16:05:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdrPn-0006Wn-Ug for emacs-devel@gnu.org; Wed, 19 Aug 2009 16:05:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdrPj-0006TD-Gs for emacs-devel@gnu.org; Wed, 19 Aug 2009 16:05:47 -0400 Original-Received: from [199.232.76.173] (port=56736 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdrPj-0006T1-Cc for emacs-devel@gnu.org; Wed, 19 Aug 2009 16:05:43 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:29884 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdrPi-0004wD-Uj for emacs-devel@gnu.org; Wed, 19 Aug 2009 16:05:43 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0EACL4i0pFpaKZ/2dsb2JhbACBUtVnhBoFh08 X-IronPort-AV: E=Sophos;i="4.43,410,1246852800"; d="scan'208";a="43812414" Original-Received: from 69-165-162-153.dsl.teksavvy.com (HELO pastel.home) ([69.165.162.153]) by ironport2-out.teksavvy.com with ESMTP; 19 Aug 2009 16:05:05 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id EFFCD82F0; Wed, 19 Aug 2009 16:05:41 -0400 (EDT) In-Reply-To: (Stuart Hacking's message of "Thu, 7 May 2009 20:57:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114413 Archived-At: > This is my first quick modification to emacs. I hope I've produced the > .diff correctly, if not, please yell at me for not correctly reading the > submission guidelines. (Also: I apologise if this is not the correct place > to submit patches - I didn't see anything about code submission on > savannah. Please advise if necessary.) > The modification changes snake.el so that new apples will be spawned at > random locations rather than being deposited behind the snake. I intended > to govern the spawn rate based on score, however, since the game speed > increases I decided this was unnecessary. This looks like an acceptable improvement, but the patch needs a few tweaks: your new spawn-rate variable seems to be a customization variable, which is never set directly by the game, so it should be declared with defcustom and should not be made-variable-buffer-local. Of course, maybe it doesn't deserve a customization (after all, 5 was hardcoded before), in which case the `defvar' is fine (but the make-variable-buffer-local is not). Also, I'm not sure why it defaults to 10, where the current code seems to use 5 for the same purpose. Finally, it'd be good to make it so that the current behavior can be preserved (under the constrol of a customization variable, or some argument when starting the game, or ...). Stefan