Subject: Re: bug#56116: Feature: new Tetris randomizer

From: Eli Zaretskii <[email-masked]>
Date: Tue, 21 Jun 2022 14:04:01 +0300

> From: Timothée Denizou <[email-masked]>
> 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.