mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added support for Picture Puzzle games, based on a concept from UltraSol.
This commit is contained in:
parent
f9024e563a
commit
3ef949d461
23 changed files with 331 additions and 29 deletions
|
@ -42,6 +42,7 @@ Cardsets Types:
|
||||||
* Dashavatara Ganjifa = 8
|
* Dashavatara Ganjifa = 8
|
||||||
* Trumps Only = 9
|
* Trumps Only = 9
|
||||||
* Matching = 10
|
* Matching = 10
|
||||||
|
* Puzzle = 11
|
||||||
|
|
||||||
*$C:* The number of cards in the cardset, generally 42, 48, 52, 68, 78, 96 or 120
|
*$C:* The number of cards in the cardset, generally 42, 48, 52, 68, 78, 96 or 120
|
||||||
|
|
||||||
|
@ -76,6 +77,7 @@ Cardsets Styles:
|
||||||
* Places = 20
|
* Places = 20
|
||||||
* Plain = 21
|
* Plain = 21
|
||||||
* Products = 22
|
* Products = 22
|
||||||
|
* Puzzle = 33
|
||||||
* Round Cardsets = 18
|
* Round Cardsets = 18
|
||||||
* Science Fiction = 23
|
* Science Fiction = 23
|
||||||
* Sports = 24
|
* Sports = 24
|
||||||
|
@ -112,7 +114,7 @@ Cardsets Origins:
|
||||||
|
|
||||||
*$F:* The Year the cardset was created (in the range 1000 to 2299)
|
*$F:* The Year the cardset was created (in the range 1000 to 2299)
|
||||||
|
|
||||||
*$G:* The subtype of the cardset. Usually 0 - for French type cardsets, a value of 1 is used if there are jokers.
|
*$G:* The subtype of the cardset. Usually 0 - for French type cardsets, a value of 1 is used if there are jokers. For Puzzle type cardsets, it is the number of pieces per row/column.
|
||||||
|
|
||||||
*$H:* Whether the cardset is a 3D Mahjongg cardset - 1 if it is, 0 if it isn't. For cardsets with a version less than 7, version 6 cardsets treat this value as 1, and older version cardsets treat it as 0.
|
*$H:* Whether the cardset is a 3D Mahjongg cardset - 1 if it is, 0 if it isn't. For cardsets with a version less than 7, version 6 cardsets treat this value as 1, and older version cardsets treat it as 0.
|
||||||
|
|
||||||
|
|
BIN
data/images/cards/bottoms/puzzle/bottom02-n.png
Normal file
BIN
data/images/cards/bottoms/puzzle/bottom02-n.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 B |
BIN
data/images/cards/bottoms/puzzle/bottom02.png
Normal file
BIN
data/images/cards/bottoms/puzzle/bottom02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 B |
|
@ -47,6 +47,9 @@ back01.ext;back02.ext;back03.ext</pre>
|
||||||
<li>
|
<li>
|
||||||
<p>Matching = 10</p>
|
<p>Matching = 10</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Puzzle = 11</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><b>$C:</b> The number of cards in the cardset, generally 42,
|
<p><b>$C:</b> The number of cards in the cardset, generally 42,
|
||||||
48, 52, 68, 78, 96 or 120</p>
|
48, 52, 68, 78, 96 or 120</p>
|
||||||
|
@ -132,6 +135,9 @@ back01.ext;back02.ext;back03.ext</pre>
|
||||||
<li>
|
<li>
|
||||||
<p>Products = 22</p>
|
<p>Products = 22</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Puzzle = 33</p>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Round Cardsets = 18</p>
|
<p>Round Cardsets = 18</p>
|
||||||
</li>
|
</li>
|
||||||
|
@ -221,7 +227,8 @@ back01.ext;back02.ext;back03.ext</pre>
|
||||||
<p><b>$F:</b> The Year the cardset was created (in the range 1000
|
<p><b>$F:</b> The Year the cardset was created (in the range 1000
|
||||||
to 2299)</p>
|
to 2299)</p>
|
||||||
<p><b>$G:</b> The subtype of the cardset. Usually 0 - for French type
|
<p><b>$G:</b> The subtype of the cardset. Usually 0 - for French type
|
||||||
cardsets, a value of 1 is used if there are jokers.</p>
|
cardsets, a value of 1 is used if there are jokers. For Puzzle type
|
||||||
|
cardsets, it is the number of pieces per row/column.</p>
|
||||||
<p><b>$H:</b> Whether the cardset is a 3D Mahjongg cardset - 1 if it is, 0
|
<p><b>$H:</b> Whether the cardset is a 3D Mahjongg cardset - 1 if it is, 0
|
||||||
if it isn't. For cardsets with a version less than 7, version 6 cardsets
|
if it isn't. For cardsets with a version less than 7, version 6 cardsets
|
||||||
treat this value as 1, and older version cardsets treat it as 0.</p>
|
treat this value as 1, and older version cardsets treat it as 0.</p>
|
||||||
|
|
|
@ -79,6 +79,7 @@ rules_files = [
|
||||||
('freecell.html', 'PySol - Rules for FreeCell'),
|
('freecell.html', 'PySol - Rules for FreeCell'),
|
||||||
('lightsout.html', 'PySol - Rules for Lights Out'),
|
('lightsout.html', 'PySol - Rules for Lights Out'),
|
||||||
('fourrivers.html', 'PySol - Rules for Four Rivers'),
|
('fourrivers.html', 'PySol - Rules for Four Rivers'),
|
||||||
|
('tilepuzzle.html', 'PySol - Rules for Tile Puzzle'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,21 @@ Matrix type. One deck. No redeals.
|
||||||
Restore game pieces to their proper order.
|
Restore game pieces to their proper order.
|
||||||
|
|
||||||
<h3>Rules</h3>
|
<h3>Rules</h3>
|
||||||
When the game opens the all game pieces except for the final piece are
|
<p>
|
||||||
dealt to the tableau in their proper order. The pieces are then scrambled
|
The pieces are dealt to a grid, based on the size of the matrix, with a single
|
||||||
to a random pattern. With the larger grids it may take several seconds for
|
blank space left. Pieces may not be lifted from the canvas. They may be moved
|
||||||
the scrambling to be completed. Pieces may not be lifted from the canvas.
|
by clicking on a piece which is in either the row or the column which has the
|
||||||
They may be moved by clicking on a piece which is in either the row or the
|
empty spot. That piece and all intervening pieces will move one space towards
|
||||||
column which has the empty spot. That piece and all intervening pieces will
|
the empty spot.
|
||||||
move one space towards the empty spot. The image game piece sets are best used
|
<p>
|
||||||
with the grid size for which they are designed. The size is indicated in the
|
Matrix games can be played with a sequential numbered cardset (Matrix), or with
|
||||||
name of the set. King of Hearts 4x4, Players Trumps 10x10, etc. The default
|
a picture puzzle cardset (Picture Matrix). With the sequential cardset, your
|
||||||
set of numbered pieces works with any grid size. When all the pieces have been
|
goal is to organize the cards in sequence, left to right, top to bottom. With
|
||||||
restored to their correct order the final piece will be dealt to the tableau and
|
a picture puzzle cardset, your goal is to assemble the picture correctly.
|
||||||
the game has been won. Every Matrix game can be solved.
|
<p>
|
||||||
|
When all the pieces have been restored to their correct order, with the blank space
|
||||||
|
in the bottom right corner, the final piece will be dealt to the tableau and the
|
||||||
|
game has been won. Every Matrix game can be solved.
|
||||||
|
|
||||||
<h3>Strategy</h3>
|
<h3>Strategy</h3>
|
||||||
Begin in the upper left hand corner and complete one row before starting the next.
|
Begin in the upper left hand corner and complete one row before starting the next.
|
||||||
Take a screen shot of the image sets before the game is scrambled.
|
|
||||||
|
|
11
html-src/rules/tilepuzzle.html
Normal file
11
html-src/rules/tilepuzzle.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<h1>Tile Puzzle</h1>
|
||||||
|
Puzzle type. One deck. No redeals.
|
||||||
|
|
||||||
|
<h3>Object</h3>
|
||||||
|
Restore game pieces to their proper order.
|
||||||
|
|
||||||
|
<h3>Rules</h3>
|
||||||
|
<p>
|
||||||
|
The pieces are dealt to a grid, based on the size of the puzzle. You may
|
||||||
|
swap any two pieces freely. Your goal is to arrange all the pieces to
|
||||||
|
successfully, and accurately, complete the picture.
|
|
@ -3,7 +3,7 @@ msgstr ""
|
||||||
"Project-Id-Version: PySol 0.0.1\n"
|
"Project-Id-Version: PySol 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:25-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:10-0400\n"
|
||||||
"Last-Translator: H. Schaekel <Holger.Schaekel@web.de>\n"
|
"Last-Translator: H. Schaekel <Holger.Schaekel@web.de>\n"
|
||||||
"Language-Team: German\n"
|
"Language-Team: German\n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
|
@ -469,6 +469,9 @@ msgstr ""
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -871,6 +874,9 @@ msgstr "Trumpf nur Typ (variable Karten)"
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Französisch"
|
msgstr "Französisch"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
||||||
"Project-Id-Version: 1.02\n"
|
"Project-Id-Version: 1.02\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:24-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:14-0400\n"
|
||||||
"Last-Translator: Eric Rausch <neelix570@gmail.com>\n"
|
"Last-Translator: Eric Rausch <neelix570@gmail.com>\n"
|
||||||
"Language-Team: French\n"
|
"Language-Team: French\n"
|
||||||
"Language: fr\n"
|
"Language: fr\n"
|
||||||
|
@ -475,6 +475,9 @@ msgstr ""
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -901,6 +904,9 @@ msgstr "Type Atouts seulement (cartes variables)"
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Français"
|
msgstr "Français"
|
||||||
|
|
|
@ -12,7 +12,7 @@ msgstr ""
|
||||||
"Project-Id-Version: it_pysol\n"
|
"Project-Id-Version: it_pysol\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:24-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:15-0400\n"
|
||||||
"Last-Translator: Giuliano Colla <giuliano.colla@gmail.com>\n"
|
"Last-Translator: Giuliano Colla <giuliano.colla@gmail.com>\n"
|
||||||
"Language-Team: Italiano <it@li.org>\n"
|
"Language-Team: Italiano <it@li.org>\n"
|
||||||
"Language: it\n"
|
"Language: it\n"
|
||||||
|
@ -481,6 +481,9 @@ msgstr ""
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -909,6 +912,9 @@ msgstr "Tipo Trionfi (carte variabili)"
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Francesi"
|
msgstr "Francesi"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
||||||
"Project-Id-Version: PySolFC\n"
|
"Project-Id-Version: PySolFC\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:22-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:15-0400\n"
|
||||||
"Last-Translator: Jerzy Trzeciak <artusek@wp.pl>\n"
|
"Last-Translator: Jerzy Trzeciak <artusek@wp.pl>\n"
|
||||||
"Language-Team: Polish <pl@li.org>\n"
|
"Language-Team: Polish <pl@li.org>\n"
|
||||||
"Language: pl\n"
|
"Language: pl\n"
|
||||||
|
@ -475,6 +475,9 @@ msgstr "Samotnik"
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr "Poker"
|
msgstr "Poker"
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -906,6 +909,9 @@ msgstr "Typ tylko Atu (różne karty)"
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Francuski"
|
msgstr "Francuski"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:23-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:16-0400\n"
|
||||||
"Last-Translator: Matheus Knack <mtknack555@gmail.com>\n"
|
"Last-Translator: Matheus Knack <mtknack555@gmail.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: pt_BR\n"
|
"Language: pt_BR\n"
|
||||||
|
@ -474,6 +474,9 @@ msgstr "Resta um"
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr "Pôquer"
|
msgstr "Pôquer"
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr "Mahjong Shinsen-Sho"
|
msgstr "Mahjong Shinsen-Sho"
|
||||||
|
|
||||||
|
@ -900,6 +903,9 @@ msgstr "Apenas tipos de trunfos (cartas variáveis)"
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr "Estilos Combinados (cartas variáveis)"
|
msgstr "Estilos Combinados (cartas variáveis)"
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Francês"
|
msgstr "Francês"
|
||||||
|
|
|
@ -449,6 +449,9 @@ msgstr ""
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -815,6 +818,9 @@ msgstr ""
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -7,7 +7,7 @@ msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
|
||||||
"PO-Revision-Date: 2023-06-29 22:23-0400\n"
|
"PO-Revision-Date: 2023-08-27 12:16-0400\n"
|
||||||
"Last-Translator: Skomoroh <skomoroh@gmail.com>\n"
|
"Last-Translator: Skomoroh <skomoroh@gmail.com>\n"
|
||||||
"Language-Team: Russian <ru@li.org>\n"
|
"Language-Team: Russian <ru@li.org>\n"
|
||||||
"Language: ru\n"
|
"Language: ru\n"
|
||||||
|
@ -478,6 +478,9 @@ msgstr ""
|
||||||
msgid "Poker"
|
msgid "Poker"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shisen-Sho"
|
msgid "Shisen-Sho"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -896,6 +899,9 @@ msgstr "Без мастей (переменное количество карт)
|
||||||
msgid "Matching type (variable cards)"
|
msgid "Matching type (variable cards)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Puzzle type (variable pieces)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pysollib/resource.py:194
|
#: pysollib/resource.py:194
|
||||||
msgid "French"
|
msgid "French"
|
||||||
msgstr "Классические"
|
msgstr "Классические"
|
||||||
|
|
|
@ -820,6 +820,10 @@ class Application:
|
||||||
t0 = "Matching"
|
t0 = "Matching"
|
||||||
if cs.ncards < (gi.ncards / 2): # not enough cards
|
if cs.ncards < (gi.ncards / 2): # not enough cards
|
||||||
t1 = t0
|
t1 = t0
|
||||||
|
elif gc == GI.GC_PUZZLE:
|
||||||
|
t0 = "Puzzle"
|
||||||
|
if cs_type not in (CSI.TYPE_PUZZLE,) or cs_subtype != gs:
|
||||||
|
t1 = t0
|
||||||
else:
|
else:
|
||||||
# we should not come here
|
# we should not come here
|
||||||
t0 = t1 = "Unknown"
|
t0 = t1 = "Unknown"
|
||||||
|
|
|
@ -3481,7 +3481,7 @@ class Game(object):
|
||||||
|
|
||||||
# for find_card_dialog
|
# for find_card_dialog
|
||||||
def canFindCard(self):
|
def canFindCard(self):
|
||||||
return self.gameinfo.category != GI.GC_MATCHING
|
return self.gameinfo.category not in (GI.GC_MATCHING, GI.GC_PUZZLE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# subclass hooks
|
# subclass hooks
|
||||||
|
|
|
@ -56,12 +56,21 @@ class GI:
|
||||||
GC_DASHAVATARA_GANJIFA = CSI.TYPE_DASHAVATARA_GANJIFA
|
GC_DASHAVATARA_GANJIFA = CSI.TYPE_DASHAVATARA_GANJIFA
|
||||||
GC_TRUMP_ONLY = CSI.TYPE_TRUMP_ONLY
|
GC_TRUMP_ONLY = CSI.TYPE_TRUMP_ONLY
|
||||||
GC_MATCHING = CSI.TYPE_MATCHING
|
GC_MATCHING = CSI.TYPE_MATCHING
|
||||||
|
GC_PUZZLE = CSI.TYPE_PUZZLE
|
||||||
|
|
||||||
NUM_CATEGORIES = CSI.TYPE_MATCHING
|
NUM_CATEGORIES = CSI.TYPE_PUZZLE
|
||||||
|
|
||||||
# game subcategory
|
# game subcategory
|
||||||
GS_NONE = CSI.SUBTYPE_NONE
|
GS_NONE = CSI.SUBTYPE_NONE
|
||||||
GS_JOKER_DECK = CSI.SUBTYPE_JOKER_DECK
|
GS_JOKER_DECK = CSI.SUBTYPE_JOKER_DECK
|
||||||
|
GS_3X3 = CSI.SUBTYPE_3X3
|
||||||
|
GS_4X4 = CSI.SUBTYPE_4X4
|
||||||
|
GS_5X5 = CSI.SUBTYPE_5X5
|
||||||
|
GS_6X6 = CSI.SUBTYPE_6X6
|
||||||
|
GS_7X7 = CSI.SUBTYPE_7X7
|
||||||
|
GS_8X8 = CSI.SUBTYPE_8X8
|
||||||
|
GS_9X9 = CSI.SUBTYPE_9X9
|
||||||
|
GS_10X10 = CSI.SUBTYPE_10X10
|
||||||
|
|
||||||
# game type
|
# game type
|
||||||
GT_1DECK_TYPE = 0
|
GT_1DECK_TYPE = 0
|
||||||
|
@ -162,6 +171,7 @@ class GI:
|
||||||
GT_MEMORY: n_("Memory"),
|
GT_MEMORY: n_("Memory"),
|
||||||
GT_PEGGED: n_("Pegged"),
|
GT_PEGGED: n_("Pegged"),
|
||||||
GT_POKER_TYPE: n_("Poker"),
|
GT_POKER_TYPE: n_("Poker"),
|
||||||
|
GT_PUZZLE_TYPE: n_("Puzzle"),
|
||||||
GT_SHISEN_SHO: n_("Shisen-Sho"),
|
GT_SHISEN_SHO: n_("Shisen-Sho"),
|
||||||
GT_TAROCK: n_("Tarock"),
|
GT_TAROCK: n_("Tarock"),
|
||||||
GT_HANOI: n_("Tower of Hanoi"),
|
GT_HANOI: n_("Tower of Hanoi"),
|
||||||
|
@ -565,7 +575,8 @@ class GI:
|
||||||
('fc-2.20', tuple(range(855, 897))),
|
('fc-2.20', tuple(range(855, 897))),
|
||||||
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
|
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
|
||||||
tuple(range(13160, 13163)) + (16682,)),
|
tuple(range(13160, 13163)) + (16682,)),
|
||||||
('dev', tuple(range(906, 913)) + tuple(range(11017, 11020))),
|
('dev', tuple(range(906, 913)) + tuple(range(11017, 11020)) +
|
||||||
|
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
|
||||||
)
|
)
|
||||||
|
|
||||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||||
|
|
|
@ -28,3 +28,4 @@ from . import larasgame # noqa: F401
|
||||||
from . import matrix # noqa: F401
|
from . import matrix # noqa: F401
|
||||||
from . import mughal # noqa: F401
|
from . import mughal # noqa: F401
|
||||||
from . import tarock # noqa: F401
|
from . import tarock # noqa: F401
|
||||||
|
from . import tilepuzzle # noqa: F401
|
||||||
|
|
|
@ -227,6 +227,22 @@ def r(id, short_name, width):
|
||||||
return gi
|
return gi
|
||||||
|
|
||||||
|
|
||||||
|
def r2(id, short_name, width):
|
||||||
|
name = short_name
|
||||||
|
ncards = width ** 2
|
||||||
|
gi = GameInfo(
|
||||||
|
id, Matrix, name,
|
||||||
|
GI.GT_MATRIX, 1, 0, GI.SL_SKILL,
|
||||||
|
category=GI.GC_PUZZLE, short_name=short_name,
|
||||||
|
subcategory=width,
|
||||||
|
suits=(), ranks=(), trumps=list(range(ncards)),
|
||||||
|
si={"decks": 1, "ncards": ncards})
|
||||||
|
gi.ncards = ncards
|
||||||
|
gi.rules_filename = "matrix.html"
|
||||||
|
registerGame(gi)
|
||||||
|
return gi
|
||||||
|
|
||||||
|
|
||||||
r(22223, "Matrix 3x3", 3)
|
r(22223, "Matrix 3x3", 3)
|
||||||
r(22224, "Matrix 4x4", 4)
|
r(22224, "Matrix 4x4", 4)
|
||||||
r(22225, "Matrix 5x5", 5)
|
r(22225, "Matrix 5x5", 5)
|
||||||
|
@ -237,4 +253,14 @@ r(22229, "Matrix 9x9", 9)
|
||||||
r(22230, "Matrix 10x10", 10)
|
r(22230, "Matrix 10x10", 10)
|
||||||
# r(22240, "Matrix 20x20", 20)
|
# r(22240, "Matrix 20x20", 20)
|
||||||
|
|
||||||
|
r2(22303, "Picture Matrix 3x3", 3)
|
||||||
|
r2(22304, "Picture Matrix 4x4", 4)
|
||||||
|
r2(22305, "Picture Matrix 5x5", 5)
|
||||||
|
r2(22306, "Picture Matrix 6x6", 6)
|
||||||
|
r2(22307, "Picture Matrix 7x7", 7)
|
||||||
|
r2(22308, "Picture Matrix 8x8", 8)
|
||||||
|
r2(22309, "Picture Matrix 9x9", 9)
|
||||||
|
r2(22310, "Picture Matrix 10x10", 10)
|
||||||
|
|
||||||
del r
|
del r
|
||||||
|
del r2
|
||||||
|
|
144
pysollib/games/ultra/tilepuzzle.py
Normal file
144
pysollib/games/ultra/tilepuzzle.py
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- mode: python; coding: utf-8; -*-
|
||||||
|
# ---------------------------------------------------------------------------##
|
||||||
|
#
|
||||||
|
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
# Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||||
|
# Copyright (C) 2005-2009 Skomoroh
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import math
|
||||||
|
|
||||||
|
from pysollib.game import Game
|
||||||
|
from pysollib.gamedb import GI, GameInfo, registerGame
|
||||||
|
from pysollib.layout import Layout
|
||||||
|
from pysollib.stack import \
|
||||||
|
InitialDealTalonStack, \
|
||||||
|
InvisibleStack, \
|
||||||
|
OpenStack
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# * Tile Puzzle Row Stack
|
||||||
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
class TilePuzzle_RowStack(OpenStack):
|
||||||
|
|
||||||
|
def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
|
||||||
|
self._swapPairMove(ncards, to_stack, frames=-1, shadow=0)
|
||||||
|
|
||||||
|
def _swapPairMove(self, n, other_stack, frames=-1, shadow=-1):
|
||||||
|
game = self.game
|
||||||
|
old_state = game.enterState(game.S_FILL)
|
||||||
|
swap = game.s.internals[0]
|
||||||
|
game.moveMove(n, self, swap, frames=0)
|
||||||
|
game.moveMove(n, other_stack, self, frames=frames, shadow=shadow)
|
||||||
|
game.moveMove(n, swap, other_stack, frames=0)
|
||||||
|
game.leaveState(old_state)
|
||||||
|
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# * Tile Puzzle Game
|
||||||
|
# ************************************************************************
|
||||||
|
|
||||||
|
class TilePuzzle(Game):
|
||||||
|
|
||||||
|
#
|
||||||
|
# Game layout
|
||||||
|
#
|
||||||
|
|
||||||
|
def createGame(self):
|
||||||
|
l, s = Layout(self), self.s
|
||||||
|
grid = math.sqrt(self.gameinfo.ncards)
|
||||||
|
assert grid == int(grid)
|
||||||
|
grid = int(grid)
|
||||||
|
|
||||||
|
# Set window size
|
||||||
|
w, h = l.XM * 2 + l.CW * grid, l.YM * 2 + l.CH * grid
|
||||||
|
self.setSize(w, h)
|
||||||
|
|
||||||
|
# Create rows
|
||||||
|
for j in range(grid):
|
||||||
|
x, y = l.XM, l.YM + l.CH * j
|
||||||
|
for i in range(grid):
|
||||||
|
s.rows.append(TilePuzzle_RowStack(x, y, self,
|
||||||
|
max_accept=1, max_cards=2))
|
||||||
|
x = x + l.CW
|
||||||
|
|
||||||
|
# Create talon
|
||||||
|
x, y = -2*l.XS, 0 # invisible
|
||||||
|
s.talon = InitialDealTalonStack(x, y, self)
|
||||||
|
|
||||||
|
s.internals.append(InvisibleStack(self))
|
||||||
|
|
||||||
|
# Define stack groups
|
||||||
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Game over rides
|
||||||
|
#
|
||||||
|
|
||||||
|
def startGame(self):
|
||||||
|
assert len(self.s.talon.cards) == self.gameinfo.ncards
|
||||||
|
self.startDealSample()
|
||||||
|
self.s.talon.dealRow(rows=self.s.rows, frames=3)
|
||||||
|
|
||||||
|
def isGameWon(self):
|
||||||
|
if self.busy:
|
||||||
|
return 0
|
||||||
|
s = self.s.rows
|
||||||
|
for r in s[:len(s)]:
|
||||||
|
if not r.cards[0].rank == r.id:
|
||||||
|
return 0
|
||||||
|
self.s.talon.dealRow(rows=s, frames=0)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
||||||
|
return ((card1.rank + 1 == card2.rank) or
|
||||||
|
(card1.rank - 1 == card2.rank))
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# * Register a Tile Puzzle game
|
||||||
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
def r(id, short_name, width):
|
||||||
|
name = short_name
|
||||||
|
ncards = width ** 2
|
||||||
|
gi = GameInfo(
|
||||||
|
id, TilePuzzle, name,
|
||||||
|
GI.GT_PUZZLE_TYPE, 1, 0, GI.SL_SKILL,
|
||||||
|
category=GI.GC_PUZZLE, short_name=short_name,
|
||||||
|
subcategory=width,
|
||||||
|
suits=(), ranks=(), trumps=list(range(ncards)),
|
||||||
|
si={"decks": 1, "ncards": ncards})
|
||||||
|
gi.ncards = ncards
|
||||||
|
gi.rules_filename = "tilepuzzle.html"
|
||||||
|
registerGame(gi)
|
||||||
|
return gi
|
||||||
|
|
||||||
|
|
||||||
|
r(22353, "Tile Puzzle 3x3", 3)
|
||||||
|
r(22354, "Tile Puzzle 4x4", 4)
|
||||||
|
r(22355, "Tile Puzzle 5x5", 5)
|
||||||
|
r(22356, "Tile Puzzle 6x6", 6)
|
||||||
|
r(22357, "Tile Puzzle 7x7", 7)
|
||||||
|
r(22358, "Tile Puzzle 8x8", 8)
|
||||||
|
r(22359, "Tile Puzzle 9x9", 9)
|
||||||
|
r(22360, "Tile Puzzle 10x10", 10)
|
||||||
|
|
||||||
|
del r
|
|
@ -202,6 +202,14 @@ highlight_piles = float(0.2, 9.9)
|
||||||
8 = string_list(min=2, max=2)
|
8 = string_list(min=2, max=2)
|
||||||
9 = string_list(min=2, max=2)
|
9 = string_list(min=2, max=2)
|
||||||
10 = string_list(min=2, max=2)
|
10 = string_list(min=2, max=2)
|
||||||
|
11_3 = string_list(min=2, max=2)
|
||||||
|
11_4 = string_list(min=2, max=2)
|
||||||
|
11_5 = string_list(min=2, max=2)
|
||||||
|
11_6 = string_list(min=2, max=2)
|
||||||
|
11_7 = string_list(min=2, max=2)
|
||||||
|
11_8 = string_list(min=2, max=2)
|
||||||
|
11_9 = string_list(min=2, max=2)
|
||||||
|
11_10 = string_list(min=2, max=2)
|
||||||
scale_cards = boolean
|
scale_cards = boolean
|
||||||
scale_x = float
|
scale_x = float
|
||||||
scale_y = float
|
scale_y = float
|
||||||
|
@ -560,7 +568,15 @@ class Options:
|
||||||
CSI.TYPE_DASHAVATARA_GANJIFA:
|
CSI.TYPE_DASHAVATARA_GANJIFA:
|
||||||
{0: ("Dashavatara Ganjifa XL", "")},
|
{0: ("Dashavatara Ganjifa XL", "")},
|
||||||
CSI.TYPE_TRUMP_ONLY: {0: ("Next Matrix", "")},
|
CSI.TYPE_TRUMP_ONLY: {0: ("Next Matrix", "")},
|
||||||
CSI.TYPE_MATCHING: {0: ("Neo", "")}
|
CSI.TYPE_MATCHING: {0: ("Neo", "")},
|
||||||
|
CSI.TYPE_PUZZLE: {3: ("Dojouji Ukiyo E (3x3)", ""),
|
||||||
|
4: ("Knave of Hearts (4x4)", ""),
|
||||||
|
5: ("Victoria Falls (5x5)", ""),
|
||||||
|
6: ("Hokusai Ukiyo E (6x6)", ""),
|
||||||
|
7: ("Blaren (7x7)", ""),
|
||||||
|
8: ("Mid Winter's Eve (8x8)", ""),
|
||||||
|
9: ("Hofamterspiel (9x9)", ""),
|
||||||
|
10: ("Eternal Dragon (10x10)", "")},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
self.cardset = {
|
self.cardset = {
|
||||||
|
@ -576,7 +592,15 @@ class Options:
|
||||||
CSI.TYPE_NAVAGRAHA_GANJIFA: {0: ("Dashavatara Ganjifa", "")},
|
CSI.TYPE_NAVAGRAHA_GANJIFA: {0: ("Dashavatara Ganjifa", "")},
|
||||||
CSI.TYPE_DASHAVATARA_GANJIFA: {0: ("Dashavatara Ganjifa", "")},
|
CSI.TYPE_DASHAVATARA_GANJIFA: {0: ("Dashavatara Ganjifa", "")},
|
||||||
CSI.TYPE_TRUMP_ONLY: {0: ("Matrix", "")},
|
CSI.TYPE_TRUMP_ONLY: {0: ("Matrix", "")},
|
||||||
CSI.TYPE_MATCHING: {0: (c, "")}
|
CSI.TYPE_MATCHING: {0: (c, "")},
|
||||||
|
CSI.TYPE_PUZZLE: {3: ("Dojouji Ukiyo E (3x3)", ""),
|
||||||
|
4: ("Knave of Hearts (4x4)", ""),
|
||||||
|
5: ("Victoria Falls (5x5)", ""),
|
||||||
|
6: ("Hokusai Ukiyo E (6x6)", ""),
|
||||||
|
7: ("Blaren (7x7)", ""),
|
||||||
|
8: ("Mid Winter's Eve (8x8)", ""),
|
||||||
|
9: ("Hofamterspiel (9x9)", ""),
|
||||||
|
10: ("Eternal Dragon (10x10)", "")},
|
||||||
}
|
}
|
||||||
|
|
||||||
# not changeable options
|
# not changeable options
|
||||||
|
|
|
@ -181,10 +181,19 @@ class CSI:
|
||||||
TYPE_DASHAVATARA_GANJIFA = 8
|
TYPE_DASHAVATARA_GANJIFA = 8
|
||||||
TYPE_TRUMP_ONLY = 9
|
TYPE_TRUMP_ONLY = 9
|
||||||
TYPE_MATCHING = 10
|
TYPE_MATCHING = 10
|
||||||
|
TYPE_PUZZLE = 11
|
||||||
|
|
||||||
# cardset subtypes
|
# cardset subtypes
|
||||||
SUBTYPE_NONE = 0
|
SUBTYPE_NONE = 0
|
||||||
SUBTYPE_JOKER_DECK = 1
|
SUBTYPE_JOKER_DECK = 1
|
||||||
|
SUBTYPE_3X3 = 3
|
||||||
|
SUBTYPE_4X4 = 4
|
||||||
|
SUBTYPE_5X5 = 5
|
||||||
|
SUBTYPE_6X6 = 6
|
||||||
|
SUBTYPE_7X7 = 7
|
||||||
|
SUBTYPE_8X8 = 8
|
||||||
|
SUBTYPE_9X9 = 9
|
||||||
|
SUBTYPE_10X10 = 10
|
||||||
|
|
||||||
TYPE = {
|
TYPE = {
|
||||||
1: _("French type (52-54 cards)"),
|
1: _("French type (52-54 cards)"),
|
||||||
|
@ -197,6 +206,7 @@ class CSI:
|
||||||
8: _("Dashavatara Ganjifa type (120 cards)"),
|
8: _("Dashavatara Ganjifa type (120 cards)"),
|
||||||
9: _("Trumps only type (variable cards)"),
|
9: _("Trumps only type (variable cards)"),
|
||||||
10: _("Matching type (variable cards)"),
|
10: _("Matching type (variable cards)"),
|
||||||
|
11: _("Puzzle type (variable pieces)")
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_NAME = {
|
TYPE_NAME = {
|
||||||
|
@ -210,6 +220,7 @@ class CSI:
|
||||||
8: _("Dashavatara Ganjifa"),
|
8: _("Dashavatara Ganjifa"),
|
||||||
9: _("Trumps only"),
|
9: _("Trumps only"),
|
||||||
10: _("Matching"),
|
10: _("Matching"),
|
||||||
|
11: _("Puzzle")
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_ID = {
|
TYPE_ID = {
|
||||||
|
@ -222,7 +233,8 @@ class CSI:
|
||||||
7: "navagraha-ganjifa",
|
7: "navagraha-ganjifa",
|
||||||
8: "dashavatara-ganjifa",
|
8: "dashavatara-ganjifa",
|
||||||
9: "trumps-only",
|
9: "trumps-only",
|
||||||
10: "matching"
|
10: "matching",
|
||||||
|
11: "puzzle"
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_SUITS = {
|
TYPE_SUITS = {
|
||||||
|
@ -235,7 +247,8 @@ class CSI:
|
||||||
7: "abcdefghi",
|
7: "abcdefghi",
|
||||||
8: "abcdefghij",
|
8: "abcdefghij",
|
||||||
9: "",
|
9: "",
|
||||||
10: ""
|
10: "",
|
||||||
|
11: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_RANKS = {
|
TYPE_RANKS = {
|
||||||
|
@ -249,6 +262,7 @@ class CSI:
|
||||||
8: list(range(12)),
|
8: list(range(12)),
|
||||||
9: list(range(0)),
|
9: list(range(0)),
|
||||||
10: list(range(0)),
|
10: list(range(0)),
|
||||||
|
11: list(range(0)),
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPE_TRUMPS = {
|
TYPE_TRUMPS = {
|
||||||
|
@ -262,6 +276,7 @@ class CSI:
|
||||||
8: (),
|
8: (),
|
||||||
9: (),
|
9: (),
|
||||||
10: (),
|
10: (),
|
||||||
|
11: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
# cardset styles
|
# cardset styles
|
||||||
|
@ -292,6 +307,7 @@ class CSI:
|
||||||
20: _("Places"), #
|
20: _("Places"), #
|
||||||
21: _("Plain"), #
|
21: _("Plain"), #
|
||||||
22: _("Products"), #
|
22: _("Products"), #
|
||||||
|
33: _("Puzzle"), #
|
||||||
18: _("Round Cardsets"), #
|
18: _("Round Cardsets"), #
|
||||||
23: _("Science Fiction"), #
|
23: _("Science Fiction"), #
|
||||||
24: _("Sports"), #
|
24: _("Sports"), #
|
||||||
|
@ -503,6 +519,16 @@ class CardsetManager(ResourceManager):
|
||||||
cs.nletters = 0
|
cs.nletters = 0
|
||||||
cs.nshadows = 0
|
cs.nshadows = 0
|
||||||
cs.trumps = list(range(cs.ncards))
|
cs.trumps = list(range(cs.ncards))
|
||||||
|
elif s == CSI.TYPE_PUZZLE:
|
||||||
|
# ???return 0 ## FIXME
|
||||||
|
# cs.nbottoms = 7
|
||||||
|
# cs.ranks = ()
|
||||||
|
# cs.suits = ""
|
||||||
|
# cs.trumps = range(cs.ncards)
|
||||||
|
cs.nbottoms = 1
|
||||||
|
cs.nletters = 0
|
||||||
|
cs.nshadows = 0
|
||||||
|
cs.trumps = list(range(cs.ncards))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -26,7 +26,8 @@ cardset_type = {
|
||||||
'7': 'Navagraha Ganjifa',
|
'7': 'Navagraha Ganjifa',
|
||||||
'8': 'Dashavatara Ganjifa',
|
'8': 'Dashavatara Ganjifa',
|
||||||
'9': 'Trump only',
|
'9': 'Trump only',
|
||||||
'10': 'Matching'
|
'10': 'Matching',
|
||||||
|
'11': 'Puzzle'
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL_IMGS = False
|
ALL_IMGS = False
|
||||||
|
|
Loading…
Add table
Reference in a new issue