1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Hint logic for Tile Puzzle.

This commit is contained in:
Joe R 2024-01-18 23:42:57 -05:00
parent d7ec6a559a
commit c11f57ce11

View file

@ -25,6 +25,7 @@ import math
from pysollib.game import Game from pysollib.game import Game
from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.gamedb import GI, GameInfo, registerGame
from pysollib.hint import AbstractHint
from pysollib.layout import Layout from pysollib.layout import Layout
from pysollib.stack import \ from pysollib.stack import \
InitialDealTalonStack, \ InitialDealTalonStack, \
@ -50,12 +51,27 @@ class TilePuzzle_RowStack(OpenStack):
game.moveMove(n, swap, other_stack, frames=0) game.moveMove(n, swap, other_stack, frames=0)
game.leaveState(old_state) game.leaveState(old_state)
# ************************************************************************
# * Tile Puzzle Hint
# ************************************************************************
class TilePuzzle_Hint(AbstractHint):
def computeHints(self):
# The hint should point one piece to its correct location.
rows = self.game.s.rows
for row in rows:
if row.cards[0].rank != row.id:
self.addHint(5000, 1, row, rows[row.cards[0].rank])
# ************************************************************************ # ************************************************************************
# * Tile Puzzle Game # * Tile Puzzle Game
# ************************************************************************ # ************************************************************************
class TilePuzzle(Game): class TilePuzzle(Game):
Hint_Class = TilePuzzle_Hint
# #
# Game layout # Game layout