From unknown Sun Jun 22 17:15:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36867: 26.2; gamegrid-add-scrore miss lower-is-better flag Resent-From: Rolf Ade Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Jul 2019 00:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36867 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 36867@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15645320149542 (code B ref -1); Wed, 31 Jul 2019 00:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Jul 2019 00:13:34 +0000 Received: from localhost ([127.0.0.1]:51395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hscFI-0002To-3B for submit@debbugs.gnu.org; Tue, 30 Jul 2019 20:13:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:34062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hscFF-0002Tg-KQ for submit@debbugs.gnu.org; Tue, 30 Jul 2019 20:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32987) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hscFE-0008S7-KV for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hscFC-0003yZ-4H for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:27 -0400 Received: from mxout5.interscholz.de ([2a01:1e8:8:141::72]:37340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hscFB-0003v7-AD for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:26 -0400 Received: from localhost (mxout5 [127.0.0.1]) by mxout5.interscholz.de (Postfix) with ESMTP id 7B7B525D89 for ; Wed, 31 Jul 2019 02:13:13 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout5.interscholz.de Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout5.interscholz.de (Postfix) with ESMTP id AB0EB25CC3 for ; Wed, 31 Jul 2019 02:13:11 +0200 (CEST) Received: from pointsman2 (p5B317A9C.dip0.t-ipconnect.de [91.49.122.156]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 729B1340371; Wed, 31 Jul 2019 02:13:18 +0200 (CEST) From: Rolf Ade Date: Wed, 31 Jul 2019 02:13:18 +0200 Message-ID: <87a7cvukm9.fsf@pointsman.de> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:1e8:8:141::72 X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) The function gamegrid-add-scrore is handy for games developer; they get a high-score management system with one call. That includes a threshold for the number of entries in the high-score file. A consequence of that is, that an entry has be removed from the list if a new, better one must be inserted. In this situation, gamegrid-add-scrore currently always removes the "lowest" result. This is good and well for "more is better" games. But is wrong for "faster is better" games. An example: https://github.com/calancha/Minesweeper This feature omission is on lisp level. The in the emacs sources included tool update-game-score (which is used by gamegrid, if it is available) support reverse opperation. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 20 22:41:49 2019 Received: (at control) by debbugs.gnu.org; 21 Aug 2019 02:41:50 +0000 Received: from localhost ([127.0.0.1]:34370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0GZJ-0003Zf-Jl for submit@debbugs.gnu.org; Tue, 20 Aug 2019 22:41:49 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:37049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0GZI-0003ZT-NK for control@debbugs.gnu.org; Tue, 20 Aug 2019 22:41:49 -0400 Received: by mail-pg1-f181.google.com with SMTP id d1so421348pgp.4 for ; Tue, 20 Aug 2019 19:41:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gYdoaN8mm+jQ3B62DJ3Eee/kBK5EX1u+oubSk1TQfcw=; b=nl5DHqZLx8vZwsSOXpCpeN6r2YgELmy5RYHXj+Rn9rngHrdEjr3Wz8CD8FhE/Hb8Fh 59EY9KmPvQwDxCEm6wDXw/8mOkSXSt9UlLz2l5SB/IzYaNO5ugQNkvMqNPncTkBUQd3Q ubwuS/anFlTFi9GaQj3kjlckfwauIzyXG6knvFzmxq9+lzSROAVou8u4ZQtxN6rCkL3Z UBnV/4a+b/zZSQcZjlMcld6lfmezZRx7OgAJbATBDEifQqRCgnBczXUnUWOH6SbxcG32 FgtPxuZBfEgYOI2b34orTiUoexWcMI7QSejEtGaMOV/YPphxIzKaYvL7UhD7QGYQXIYC IxCw== X-Gm-Message-State: APjAAAXFsL8mDT/hnA+q1clXISKwRiohFVSPpB+mduKkqLPctJiq8kc9 aTkNoz2TXR8eEgJl9lsbx3nl+gEccPONyTKGHkE4gPngIZc= X-Google-Smtp-Source: APXvYqw9PGh1KSz/JGPXkD+Fn6oRPh0cxKiIQF/ENNhEYRzmsF7BIPl66K294IZxb8ZTbIpOl4sMZx2SkELDgd1y85s= X-Received: by 2002:aa7:9552:: with SMTP id w18mr32748282pfq.107.1566355302476; Tue, 20 Aug 2019 19:41:42 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Wed, 21 Aug 2019 04:41:31 +0200 Message-ID: Subject: bug#36867: 26.2; gamegrid-add-scrore miss lower-is-better flag To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) severity 36867 wishlist thanks From unknown Sun Jun 22 17:15:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36867: 26.2; gamegrid-add-scrore miss lower-is-better flag Resent-From: Federico Tedin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Sep 2019 22:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36867 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Rolf Ade Cc: 36867@debbugs.gnu.org Received: via spool by 36867-submit@debbugs.gnu.org id=B36867.156754977415428 (code B ref 36867); Tue, 03 Sep 2019 22:30:01 +0000 Received: (at 36867) by debbugs.gnu.org; 3 Sep 2019 22:29:34 +0000 Received: from localhost ([127.0.0.1]:60655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i5HIr-00040m-Jy for submit@debbugs.gnu.org; Tue, 03 Sep 2019 18:29:34 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:42664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i5HIp-00040W-6L for 36867@debbugs.gnu.org; Tue, 03 Sep 2019 18:29:31 -0400 Received: by mail-wr1-f41.google.com with SMTP id b16so19085456wrq.9 for <36867@debbugs.gnu.org>; Tue, 03 Sep 2019 15:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=C5jg+YvG4prQqSM3UKw6VAYgYSQPSx888wr3UHTANeA=; b=PCmOzCVJ7q+Jv0McaS4D1tG/a4yQuR6BgpYRg4iXk8ntYkfvMM61N7qrxRVONOiUiL i5iocw2Ai03PlQUY54DG7A7cD9+ECUtxAKjvhJhDar6fIR7atJNPsjQ84/Ki6Nz0YiBv KolxBRI8FdaQxPVXpsVBKZxqX9oadH2BAYB/9nAv+9yG+UFScCB3BNHrZk5AwEcsFCa1 n0amGH9t0j4Sxap0oxTb9PJmyeSA07M7ctELNu8Uj0ijdbW8S4kAt78gSsLaFoQRp8RB wNQty7q9OQWtPCHg4hog83QC12Ru+KF5dVUYDEu/plSFswL8gVPbHEIX4ZMHPIRLC4oa WHZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=C5jg+YvG4prQqSM3UKw6VAYgYSQPSx888wr3UHTANeA=; b=CwiViVHHuO7oQH2KsTMJwi0ZeD9WMvR9FMznM0cYxSugPizlGnZ+5MRG7wE1AIphdt pqp6GV1vHCkNwIUIzAEKOfVnwLinf8MSu1Y4uW3zQAzLJ58tLcp23AkmC/dyTFkDi/hS gjmsm1mRw6iOxKVIvq3Y+CTiQ9gCLtclSDcGQRtYO5n/onU/0otI5YwemsmwQpRzAio7 Tnb4J4vi4rWukSfEHAWe7dHiv/cPnSY/8NFMVerMWD7ykKx/tHSZ09UKFCVlar0tZ/Sa myIKOBxSM9aNrhav9ab+UvzXvElwVcU/WrAlPssD1gMJQpltdUYmGQCb+zwYptIs8+1j N1gQ== X-Gm-Message-State: APjAAAUa1TTmqGchF2DRUaWhY+fYGuXZYnSvu13fntCSCJo3SmzPnDeA 4XvJtd6ce/Q8zELNCrmxYnQZiotj X-Google-Smtp-Source: APXvYqxaXCwaYP2T7AbwN62hX63oecSWhsZAk8ULbDfgUW/wQdyfajc6OGX8Rbc7OqnjxJ0HTA+fZg== X-Received: by 2002:adf:e3ce:: with SMTP id k14mr42709975wrm.303.1567549764648; Tue, 03 Sep 2019 15:29:24 -0700 (PDT) Received: from lead (dslb-188-103-110-026.188.103.pools.vodafone-ip.de. [188.103.110.26]) by smtp.gmail.com with ESMTPSA id s1sm65995059wrg.80.2019.09.03.15.29.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 15:29:23 -0700 (PDT) From: Federico Tedin References: <87a7cvukm9.fsf@pointsman.de> Date: Wed, 04 Sep 2019 00:29:22 +0200 In-Reply-To: <87a7cvukm9.fsf@pointsman.de> (Rolf Ade's message of "Wed, 31 Jul 2019 02:13:18 +0200") Message-ID: <8736hdf1z1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Rolf Ade writes: > The function gamegrid-add-scrore is handy for games developer; they get > a high-score management system with one call. That includes a threshold > for the number of entries in the high-score file. > > A consequence of that is, that an entry has be removed from the list if > a new, better one must be inserted. In this situation, > gamegrid-add-scrore currently always removes the "lowest" result. > > This is good and well for "more is better" games. But is wrong for > "faster is better" games. An example: > https://github.com/calancha/Minesweeper > > This feature omission is on lisp level. The in the emacs sources > included tool update-game-score (which is used by gamegrid, if it is > available) support reverse opperation. I've added a new 'reverse' parameter to gamegrid-add-score that allows switching between storing the scores normally, or in reverse order. As Rolf mentioned, this feature was already implemented in update-game-score. I'm attaching a patch with my changes. - Fede --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=gamegrid.patch Content-Description: patch >From d866bf870ad8e9dc6147728f12cfc796d75dfbc0 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Wed, 4 Sep 2019 00:18:11 +0200 Subject: [PATCH 1/1] Allow gamegrid-add-score to treat lower scores as better. * lisp/play/gamegrid.el (gamegrid-add-score): Add 'reverse' parameter. (gamegrid-add-score-with-update-game-score): Add 'reverse' parameter. (gamegrid-add-score-with-update-game-score-1): Add 'reverse' parameter. Pass on "-r" argument to update-game-score. (gamegrid-add-score-insecure): Add 'reverse' parameter, reverse scores when it's non-nil. * etc/NEWS: Announce the change. --- etc/NEWS | 3 +++ lisp/play/gamegrid.el | 49 ++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d5130e9f3c..05b02e8653 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1370,6 +1370,9 @@ the Elisp manual for documentation of the new mode and its commands. dimensions, instead of always using 16 pixels. As a result, Tetris, Snake and Pong are more playable on HiDPI displays. +*** 'gamegrid-add-score' can now sort scores from lower to higher. +This is useful for games where lower scores are better, like time-based games. + ** Filecache --- diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index be09a73a1f..df9b135248 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el @@ -505,9 +505,12 @@ gamegrid-kill-timer ;; ;;;;;;;;;;;;;;; high score functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun gamegrid-add-score (file score) +(defun gamegrid-add-score (file score &optional reverse) "Add the current score to the high score file. +If REVERSE is non-nil, treat lower scores as better than higher +scores. This is useful for games where lower scores are better. + On POSIX systems there may be a shared game directory for all users in which the scorefiles are kept. On such systems Emacs doesn't create the score file FILE in this directory, if it doesn't already exist. @@ -525,9 +528,9 @@ gamegrid-add-score FILE is created there." (pcase system-type ((or 'ms-dos 'windows-nt) - (gamegrid-add-score-insecure file score)) + (gamegrid-add-score-insecure file score reverse)) (_ - (gamegrid-add-score-with-update-game-score file score)))) + (gamegrid-add-score-with-update-game-score file score reverse)))) ;; On POSIX systems there are four cases to distinguish: @@ -556,20 +559,21 @@ gamegrid-add-score (defvar gamegrid-shared-game-dir) -(defun gamegrid-add-score-with-update-game-score (file score) +(defun gamegrid-add-score-with-update-game-score (file score &optional reverse) (let* ((update-game-score-modes (file-modes (expand-file-name "update-game-score" exec-directory))) (gamegrid-shared-game-dir (not (zerop (logand #o6000 (or update-game-score-modes 0)))))) (cond ((or (not update-game-score-modes) (file-name-absolute-p file)) (gamegrid-add-score-insecure file score - gamegrid-user-score-file-directory)) + gamegrid-user-score-file-directory + reverse)) ((and gamegrid-shared-game-dir (file-exists-p (expand-file-name file shared-game-score-directory))) ;; Use the setgid (or setuid) "update-game-score" program ;; to update a system-wide score file. (gamegrid-add-score-with-update-game-score-1 file - (expand-file-name file shared-game-score-directory) score)) + (expand-file-name file shared-game-score-directory) score reverse)) ;; Else: Add the score to a score file in the user's home ;; directory. (gamegrid-shared-game-dir @@ -579,7 +583,8 @@ gamegrid-add-score-with-update-game-score (directory-file-name gamegrid-user-score-file-directory)) (make-directory gamegrid-user-score-file-directory t)) (gamegrid-add-score-insecure file score - gamegrid-user-score-file-directory)) + gamegrid-user-score-file-directory + reverse)) (t (unless (file-exists-p (directory-file-name gamegrid-user-score-file-directory)) @@ -588,9 +593,9 @@ gamegrid-add-score-with-update-game-score gamegrid-user-score-file-directory))) (unless (file-exists-p f) (write-region "" nil f nil 'silent nil 'excl)) - (gamegrid-add-score-with-update-game-score-1 file f score)))))) + (gamegrid-add-score-with-update-game-score-1 file f score reverse)))))) -(defun gamegrid-add-score-with-update-game-score-1 (file target score) +(defun gamegrid-add-score-with-update-game-score-1 (file target score &optional reverse) (let ((default-directory "/") (errbuf (generate-new-buffer " *update-game-score loss*")) (marker-string (concat @@ -601,17 +606,16 @@ gamegrid-add-score-with-update-game-score-1 (with-local-quit (apply 'call-process - (append - (list - (expand-file-name "update-game-score" exec-directory) - nil errbuf nil - "-m" (int-to-string gamegrid-score-file-length) - "-d" (if gamegrid-shared-game-dir - (expand-file-name shared-game-score-directory) - (file-name-directory target)) - file - (int-to-string score) - marker-string)))) + `(,(expand-file-name "update-game-score" exec-directory) + nil ,errbuf nil + "-m" ,(int-to-string gamegrid-score-file-length) + "-d" ,(if gamegrid-shared-game-dir + (expand-file-name shared-game-score-directory) + (file-name-directory target)) + ,@(if reverse '("-r")) + ,file + ,(int-to-string score) + ,marker-string))) (if (buffer-modified-p errbuf) (progn (display-buffer errbuf) @@ -632,7 +636,7 @@ gamegrid-add-score-with-update-game-score-1 marker-string) nil t) (beginning-of-line))))) -(defun gamegrid-add-score-insecure (file score &optional directory) +(defun gamegrid-add-score-insecure (file score &optional directory reverse) (save-excursion (setq file (expand-file-name file (or directory temporary-file-directory))) @@ -645,7 +649,8 @@ gamegrid-add-score-insecure (user-full-name) user-mail-address)) (sort-fields 1 (point-min) (point-max)) - (reverse-region (point-min) (point-max)) + (unless reverse + (reverse-region (point-min) (point-max))) (goto-char (point-min)) (forward-line gamegrid-score-file-length) (delete-region (point) (point-max)) -- 2.17.1 --=-=-=-- From unknown Sun Jun 22 17:15:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Rolf Ade Subject: bug#36867: closed (Re: bug#36867: 26.2; gamegrid-add-scrore miss lower-is-better flag) Message-ID: References: <83ftkzz3p0.fsf@gnu.org> <87a7cvukm9.fsf@pointsman.de> X-Gnu-PR-Message: they-closed 36867 X-Gnu-PR-Package: emacs Reply-To: 36867@debbugs.gnu.org Date: Sat, 14 Sep 2019 08:24:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1568449441-31914-1" This is a multi-part message in MIME format... ------------=_1568449441-31914-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #36867: 26.2; gamegrid-add-scrore miss lower-is-better flag which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 36867@debbugs.gnu.org. --=20 36867: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36867 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1568449441-31914-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 36867-done) by debbugs.gnu.org; 14 Sep 2019 08:23:32 +0000 Received: from localhost ([127.0.0.1]:45831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i93L9-0008Hg-SH for submit@debbugs.gnu.org; Sat, 14 Sep 2019 04:23:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i93L7-0008HO-MR for 36867-done@debbugs.gnu.org; Sat, 14 Sep 2019 04:23:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i93L2-0003bY-7W; Sat, 14 Sep 2019 04:23:24 -0400 Received: from [176.228.60.248] (port=2398 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1i93L1-0008PB-NB; Sat, 14 Sep 2019 04:23:24 -0400 Date: Sat, 14 Sep 2019 11:23:39 +0300 Message-Id: <83ftkzz3p0.fsf@gnu.org> From: Eli Zaretskii To: Federico Tedin In-reply-to: <8736hdf1z1.fsf@gmail.com> (message from Federico Tedin on Wed, 04 Sep 2019 00:29:22 +0200) Subject: Re: bug#36867: 26.2; gamegrid-add-scrore miss lower-is-better flag References: <87a7cvukm9.fsf@pointsman.de> <8736hdf1z1.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36867-done Cc: rolf@pointsman.de, 36867-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Federico Tedin > Date: Wed, 04 Sep 2019 00:29:22 +0200 > Cc: 36867@debbugs.gnu.org > > Rolf Ade writes: > > > The function gamegrid-add-scrore is handy for games developer; they get > > a high-score management system with one call. That includes a threshold > > for the number of entries in the high-score file. > > > > A consequence of that is, that an entry has be removed from the list if > > a new, better one must be inserted. In this situation, > > gamegrid-add-scrore currently always removes the "lowest" result. > > > > This is good and well for "more is better" games. But is wrong for > > "faster is better" games. An example: > > https://github.com/calancha/Minesweeper > > > > This feature omission is on lisp level. The in the emacs sources > > included tool update-game-score (which is used by gamegrid, if it is > > available) support reverse opperation. > > I've added a new 'reverse' parameter to gamegrid-add-score that allows > switching between storing the scores normally, or in reverse order. As > Rolf mentioned, this feature was already implemented in > update-game-score. I'm attaching a patch with my changes. Thanks, pushed to the master branch. In the future, please mark NEWS entries with "---" if they don't need to be described in the manuals, and with "+++" if the patch includes the changes for the manuals. (I did this for you this time.) ------------=_1568449441-31914-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 31 Jul 2019 00:13:34 +0000 Received: from localhost ([127.0.0.1]:51395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hscFI-0002To-3B for submit@debbugs.gnu.org; Tue, 30 Jul 2019 20:13:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:34062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hscFF-0002Tg-KQ for submit@debbugs.gnu.org; Tue, 30 Jul 2019 20:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32987) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hscFE-0008S7-KV for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hscFC-0003yZ-4H for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:27 -0400 Received: from mxout5.interscholz.de ([2a01:1e8:8:141::72]:37340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hscFB-0003v7-AD for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2019 20:13:26 -0400 Received: from localhost (mxout5 [127.0.0.1]) by mxout5.interscholz.de (Postfix) with ESMTP id 7B7B525D89 for ; Wed, 31 Jul 2019 02:13:13 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout5.interscholz.de Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout5.interscholz.de (Postfix) with ESMTP id AB0EB25CC3 for ; Wed, 31 Jul 2019 02:13:11 +0200 (CEST) Received: from pointsman2 (p5B317A9C.dip0.t-ipconnect.de [91.49.122.156]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 729B1340371; Wed, 31 Jul 2019 02:13:18 +0200 (CEST) From: Rolf Ade To: bug-gnu-emacs@gnu.org Subject: 26.2; gamegrid-add-scrore miss lower-is-better flag Date: Wed, 31 Jul 2019 02:13:18 +0200 Message-ID: <87a7cvukm9.fsf@pointsman.de> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:1e8:8:141::72 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) The function gamegrid-add-scrore is handy for games developer; they get a high-score management system with one call. That includes a threshold for the number of entries in the high-score file. A consequence of that is, that an entry has be removed from the list if a new, better one must be inserted. In this situation, gamegrid-add-scrore currently always removes the "lowest" result. This is good and well for "more is better" games. But is wrong for "faster is better" games. An example: https://github.com/calancha/Minesweeper This feature omission is on lisp level. The in the emacs sources included tool update-game-score (which is used by gamegrid, if it is available) support reverse opperation. ------------=_1568449441-31914-1--