Skip to content

Commit

Permalink
Ishido initial deals should include every color/symbol.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Dec 2, 2023
1 parent 3e5631d commit 9db799f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions html-src/rules/ishido.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ <h3>Rules</h3>
<p>
The tiles are played to an grid of eight rows of twelve columns each.
At the start of the game, a tile is placed in each corner, and two are
placed in two diagonally adjacent spaces in the center.
placed in two diagonally adjacent spaces in the center. The initially
placed tiles include one of each color and one of each symbol.
<p>
Tiles are drawn from the talon one at a time, and can be played to the
main playing area. A tile can only be played if it is adjacent to
Expand All @@ -26,4 +27,4 @@ <h3>Rules</h3>
<h3>History</h3>
<p>
Ishido was originally published as a video game "Ishido: The Way of Stones"
in 1990. It has since been recreated many times.
by Accolade in 1990. It has since been recreated many times.
15 changes: 15 additions & 0 deletions pysollib/games/special/ishido.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ def startGame(self):
def isGameWon(self):
return len(self.s.talon.cards) == 0

def _shuffleHook(self, cards):
# prepare first cards
symbols = []
colors = []
topcards = []
for c in cards[:]:
if c.suit not in colors and c.rank not in symbols:
topcards.append(c)
cards.remove(c)
symbols.append(c.rank)
colors.append(c.suit)
if len(colors) >= 6 or len(symbols) >= 6:
break
return cards + topcards

def isValidPlay(self, playSpace, playRank, playSuit):
# check that there's an adjacent card
adjacent = self.getAdjacent(playSpace)
Expand Down

0 comments on commit 9db799f

Please sign in to comment.