From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stuart Hacking Newsgroups: gmane.emacs.devel Subject: Randomise spawning apples in snake.el Date: Thu, 7 May 2009 20:57:28 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-25--721440370" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1241735788 28265 80.91.229.12 (7 May 2009 22:36:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 May 2009 22:36:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 08 00:36:20 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 1M2CCQ-0007qM-Qd for ged-emacs-devel@m.gmane.org; Fri, 08 May 2009 00:36:19 +0200 Original-Received: from localhost ([127.0.0.1]:55093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2CCP-0006d6-TE for ged-emacs-devel@m.gmane.org; Thu, 07 May 2009 18:36:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M29iq-00031m-Eo for emacs-devel@gnu.org; Thu, 07 May 2009 15:57:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M29ip-00030y-UR for emacs-devel@gnu.org; Thu, 07 May 2009 15:57:36 -0400 Original-Received: from [199.232.76.173] (port=60158 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M29ip-00030p-PM for emacs-devel@gnu.org; Thu, 07 May 2009 15:57:35 -0400 Original-Received: from ey-out-1920.google.com ([74.125.78.147]:27531) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M29io-0004WT-Qw for emacs-devel@gnu.org; Thu, 07 May 2009 15:57:35 -0400 Original-Received: by ey-out-1920.google.com with SMTP id 13so281951eye.24 for ; Thu, 07 May 2009 12:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:mime-version:subject:date:x-pgp-agent :content-transfer-encoding:x-mailer; bh=C+5JFJYTm3VvvPemv2x8uqGclyy+HIt9FQ+UFDinhxg=; b=SEM0oDJxNDJVVqieQVOIFpYJwAlKyivgGM8IqDx2bd99KfRVatKFCE1op7c/E8CBDs gacYwkc5/wKxUbgaoU0t00oUUZSaE6kYsTajSfTiHfCmUxdKu61sD5+0+baJ2lw9IRSf Ut98PB/gheNgfJFYG1J67QwiOzUxP3/4OJjS0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:mime-version:subject:date :x-pgp-agent:content-transfer-encoding:x-mailer; b=RwwIpCDa+k2+uCioZajbdGuVuHoZuAXpm3Fi+pyLu5XgD7z0BaW2rDzysr1Z8/K5Ca Xnw8DPBGVusfFx0pbZXaBGhDLVkJjtLfj7UpcPnR2L0fwejHAgZ3sOgt7Nzsu3WLu4O/ vI76pMlk3o7pAio3LpyLhQsXvCBCzEl2Wb1Kc= Original-Received: by 10.210.30.1 with SMTP id d1mr7920193ebd.58.1241726252834; Thu, 07 May 2009 12:57:32 -0700 (PDT) Original-Received: from vindication.home (host86-131-136-91.range86-131.btcentralplus.com [86.131.136.91]) by mx.google.com with ESMTPS id 28sm87985eye.46.2009.05.07.12.57.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 07 May 2009 12:57:31 -0700 (PDT) X-Pgp-Agent: GPGMail d55 (v55, Leopard) X-Mailer: Apple Mail (2.930.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Thu, 07 May 2009 18:34:10 -0400 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:110763 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-25--721440370 Content-Type: multipart/mixed; boundary=Apple-Mail-24--721440438 --Apple-Mail-24--721440438 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi, 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. Hope this provides enjoyment for someone - now onto bigger and better things! :-) Kindest Regards Stuart --Apple-Mail-24--721440438 Content-Disposition: attachment; filename=snake_rand_apples.el.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="snake_rand_apples.el.diff" Content-Transfer-Encoding: 7bit Index: lisp/play/snake.el =================================================================== RCS file: /sources/emacs/emacs/lisp/play/snake.el,v retrieving revision 1.24 diff -r1.24 snake.el 149a150 > (defvar spawn-rate 10) 169a171 > (make-variable-buffer-local 'spawn-rate) 242a245 > spawn-rate 10 280,282c283,285 < (if (= (% snake-cycle 5) 0) < snake-dot < snake-blank)) --- > snake-blank) > (if (= (% snake-cycle spawn-rate) 0) > (snake-put-dot)) 289a293,298 > (defun snake-put-dot () > (let ((x (1+ (random (- snake-width 2)))) > (y (1+ (random (- snake-height 2))))) > (if (= (gamegrid-get-cell x y) snake-blank) > (gamegrid-set-cell x y snake-dot)))) > --Apple-Mail-24--721440438-- --Apple-Mail-25--721440370 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFKAz0owJsBhz2SPWYRAmBHAJ0RgvzN2HYg3fz8b9mP6Ym27AOa+QCeNBxP tSyPa58vO+N02Kgow3XLCBU= =++x6 -----END PGP SIGNATURE----- --Apple-Mail-25--721440370--