From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56116: Feature: new Tetris randomizer Date: Tue, 21 Jun 2022 14:04:01 +0300 Message-ID: <83bkuml1lq.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56116@debbugs.gnu.org To: =?UTF-8?Q?Timoth=C3=A9e?= Denizou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 21 13:06:26 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o3biE-0003PW-3j for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jun 2022 13:06:26 +0200 Original-Received: from localhost ([::1]:55702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3biD-0000G8-42 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jun 2022 07:06:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3bgs-0006uu-4s for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 07:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3bgr-0003JI-RM for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 07:05:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o3bgr-0002vt-Mb for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2022 07:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jun 2022 11:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 56116-submit@debbugs.gnu.org id=B56116.165580946411221 (code B ref 56116); Tue, 21 Jun 2022 11:05:01 +0000 Original-Received: (at 56116) by debbugs.gnu.org; 21 Jun 2022 11:04:24 +0000 Original-Received: from localhost ([127.0.0.1]:59235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3bgG-0002uv-1A for submit@debbugs.gnu.org; Tue, 21 Jun 2022 07:04:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3bgB-0002uf-Mk for 56116@debbugs.gnu.org; Tue, 21 Jun 2022 07:04:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3bg6-0003EM-EM; Tue, 21 Jun 2022 07:04:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=nPHQHNvc6fw3rBip3dTTru2Y4L2mhVCe/KLJLtLSHK4=; b=eb1Hknzd9qPWTwMl7Kzg avLoJC7vnuSiJ7RBOBgu+2X+3PaEQnshSNCUIPjbejZAvjgx3zE8F5/dVE7EZl7MFiOP3Yh0afasn bQchprFJTFwMp0CAAW+CXwSc4Mwaz36MeaSLF5LWKt88u0iz9wDP3m7VdvAze5sIFKONSnxMNNX8N zYnkPZv+F1qx0dWhbE/E7quIg4j1JY5O789MJEf5/o2/a6fVFKwvtrIDpDaCKIyFesfmmszbpC4PV 1NepK0fe5emphcDHdbbwh0WSYA4IHSqRZuC0sv1qWCjqF5zfwzjGZv2E9RFtVkyLT1h/bUxOF1+AW DoP888nd9WCcrA==; Original-Received: from [87.69.77.57] (port=3985 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3bg5-0003K1-V7; Tue, 21 Jun 2022 07:04:14 -0400 In-Reply-To: (message from =?UTF-8?Q?Timoth=C3=A9e?= Denizou on Mon, 20 Jun 2022 23:41:42 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234943 Archived-At: > From: Timothée Denizou > 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.