[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Randomise spawning apples in snake.el
From: |
Stefan Monnier |
Subject: |
Re: Randomise spawning apples in snake.el |
Date: |
Wed, 19 Aug 2009 16:05:41 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Randomise spawning apples in snake.el,
Stefan Monnier <=