unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Timothée Denizou" <denizoutimothee@gmail.com>
Cc: 56116@debbugs.gnu.org
Subject: bug#56116: Feature: new Tetris randomizer
Date: Tue, 21 Jun 2022 14:04:01 +0300	[thread overview]
Message-ID: <83bkuml1lq.fsf@gnu.org> (raw)
In-Reply-To: <CAHnNzdgk2=9pQwWcuud0EYtzuQXFpaF9BKVDuhfB3yAZ82usMQ@mail.gmail.com> (message from Timothée Denizou on Mon, 20 Jun 2022 23:41:42 +0200)

> From: Timothée Denizou <denizoutimothee@gmail.com>
> Date: Mon, 20 Jun 2022 23:41:42 +0200
> 
> Getting frustrated about having 4 time in a row the same tetromino ?
> 
> Wait no further !
> 
> This patch implement the seven bag randomizer, pulling a piece out of
> the bag each time and filling the bag when it is empty. This allows for
> a more uniform distribution on small samples.

Thanks.  A few comments below.

> At our school, we have plenty of time at the end of mcqs to play tetris
> in emacs and this was something I wanted to change for a bit.
> 
> This is also my first contribution ever on an open source project.
> The code may not be well formatted.

This patch is small enough for us to accept it unconditionally, but if
you plan on contributing in future, we'd need you to sign copyright
assignment papers.  If you're okay with that, I will send you the form
to fill and the instructions to go with it.

> Subject: [PATCH] Feature new tetris randomizer
> 
> * Added 7 bag randomizer for tetris
>  A piece is selected from the bag and removed each time we want a piece
>  When the bag is empty, refill the bag with the seven piece and shuffle it

Please use our conventions of formatting commit log messages like
ChangeLog entries.  You can find the details in the file CONTRIBUTE.

The description enough is good, but maybe a better place for it would
be a comment near the relevant code.

> +(defun tetris-shuffle (sequence)
> +  (loop for i from (length sequence) downto 2 do
> +    (rotatef (elt sequence (random i))
> +             (elt sequence (1- i))))
> +  sequence)

I guess you meant cl-rotatef?  rotatef is unbound in "emacs -Q", even
after I load tetris.el.





      parent reply	other threads:[~2022-06-21 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 21:41 bug#56116: Feature: new Tetris randomizer Timothée Denizou
2022-06-21 10:59 ` Lars Ingebrigtsen
2022-06-21 13:08   ` Visuwesh
2022-06-21 17:37     ` Timothée Denizou
2022-06-21 19:51       ` Lars Ingebrigtsen
2022-06-21 20:40         ` Timothée Denizou
2022-06-22  2:25       ` Eli Zaretskii
2022-06-21 11:04 ` Eli Zaretskii [this message]

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=83bkuml1lq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56116@debbugs.gnu.org \
    --cc=denizoutimothee@gmail.com \
    /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).