From 6d7073b067531bf403cd5f9dc85ad11b437e7d03 Mon Sep 17 00:00:00 2001 From: Joe R Date: Sun, 9 May 2021 09:58:26 -0400 Subject: [PATCH] Organized three peaks variations. --- html-src/rules/threepeaks.html | 5 +-- html-src/rules/threepeaksnonscoring.html | 10 ------ pysollib/gamedb.py | 2 +- pysollib/games/threepeaks.py | 45 +++++++++++++++++++----- 4 files changed, 41 insertions(+), 21 deletions(-) delete mode 100644 html-src/rules/threepeaksnonscoring.html diff --git a/html-src/rules/threepeaks.html b/html-src/rules/threepeaks.html index ee443593..b391f207 100644 --- a/html-src/rules/threepeaks.html +++ b/html-src/rules/threepeaks.html @@ -9,7 +9,8 @@ The object is to remove all the cards from the tableau by playing them to the waste stack. Cards from the tableau will play to the waste if they are one rank higher or lower than the card at the top of the waste. A King will play on an Ace and vice versa. Cards are -played to the waste by clicking on them. Points are made as follows: +played to the waste by clicking on them. In variations with scoring, +points are made as follows:
When a hand is dealt 52 points are subtracted from the score. @@ -33,4 +34,4 @@ played to the waste by clicking on them. Points are made as follows:

Notes

-Undo is disabled in this game. +In variations with scoring, undo is disabled in this game. diff --git a/html-src/rules/threepeaksnonscoring.html b/html-src/rules/threepeaksnonscoring.html deleted file mode 100644 index b0ec167a..00000000 --- a/html-src/rules/threepeaksnonscoring.html +++ /dev/null @@ -1,10 +0,0 @@ -

Three Peaks Non-scoring

-Pairing type game. 1 deck. No redeal. - -

Object

-Remove all cards from the tableau. - -

Rules

-Play is identical to -Three Peaks -except no score is kept and plays can be undone. diff --git a/pysollib/gamedb.py b/pysollib/gamedb.py index ad0a2248..b824384f 100644 --- a/pysollib/gamedb.py +++ b/pysollib/gamedb.py @@ -311,7 +311,7 @@ class GI: ("Gordon Bower", (763, 783,)), ("Art Cabral", (9,)), ("Robert Harbin", (381,)), - ("Robert Hogue", (22216,)), + ("Robert Hogue", (22216, 22217, 22218, 22231,)), ("Charles Jewell", (220, 309,)), ("Michael Keller", (592,)), ("Fred Lunde", (459,)), diff --git a/pysollib/games/threepeaks.py b/pysollib/games/threepeaks.py index c516a87e..69bfa859 100644 --- a/pysollib/games/threepeaks.py +++ b/pysollib/games/threepeaks.py @@ -173,13 +173,13 @@ class ThreePeaks(Game): # Game over rides # - def startGame(self): + def startGame(self, flip=0): assert len(self.s.talon.cards) == self.gameinfo.ncards self.game_score = self.game_score + self.hand_score self.hand_score = -52 self.peaks = [0] * 3 self.startDealSample() - self.s.talon.dealRow(rows=self.s.rows[:18], flip=0, frames=4) + self.s.talon.dealRow(rows=self.s.rows[:18], flip=flip, frames=4) self.s.talon.dealRow(rows=self.s.rows[18:], flip=1, frames=4) self.s.talon.dealCards() @@ -261,9 +261,38 @@ class ThreePeaksNoScore(ThreePeaks): return True -registerGame(GameInfo(22216, ThreePeaks, "Three Peaks", - GI.GT_PAIRING_TYPE | GI.GT_SCORE, 1, 0, GI.SL_BALANCED, - altnames=("Tri Peaks",) - )) -registerGame(GameInfo(22231, ThreePeaksNoScore, "Three Peaks Non-scoring", - GI.GT_PAIRING_TYPE, 1, 0, GI.SL_BALANCED)) +# ************************************************************************ +# * Three Peaks Game Open +# ************************************************************************ + +class ThreePeaksOpen(ThreePeaks): + SCORING = 0 + + def canUndo(self): + return True + + def startGame(self): + ThreePeaks.startGame(self, flip=1) + + +# ************************************************************************ +# * Three Peaks Game Open with scoring +# ************************************************************************ + +class ThreePeaksOpenScored(ThreePeaks): + def startGame(self): + ThreePeaks.startGame(self, flip=1) + + +registerGame(GameInfo(22216, ThreePeaks, "Three Peaks (Scored)", + GI.GT_GOLF | GI.GT_SCORE, 1, 0, GI.SL_BALANCED, + rules_filename="threepeaks.html")) +registerGame(GameInfo(22217, ThreePeaksOpen, "Three Peaks (Open)", + GI.GT_GOLF | GI.GT_OPEN, 1, 0, GI.SL_BALANCED, + rules_filename="threepeaks.html")) +registerGame(GameInfo(22218, ThreePeaksOpenScored, "Three Peaks (Scored/Open)", + GI.GT_GOLF | GI.GT_OPEN | GI.GT_SCORE, 1, 0, + GI.SL_BALANCED, rules_filename="threepeaks.html")) +registerGame(GameInfo(22231, ThreePeaksNoScore, "Three Peaks", + GI.GT_GOLF, 1, 0, GI.SL_BALANCED, + altnames=("Tri Peaks",)))