mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Add support for "10" instead of "T".
See https://github.com/shlomif/PySolFC/issues/79 .
This commit is contained in:
parent
04a9b4c910
commit
23001f0f0f
2 changed files with 10 additions and 4 deletions
|
@ -849,7 +849,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
|
|
||||||
RANKS_S = "A23456789TJQK"
|
RANKS_S = "A23456789TJQK"
|
||||||
RANKS0_S = '0' + RANKS_S
|
RANKS0_S = '0' + RANKS_S
|
||||||
RANKS_RE = '[' + RANKS_S + ']'
|
RANKS_RE = '(?:' + '[' + RANKS_S + ']' + '|10)'
|
||||||
SUITS_S = "CSHD"
|
SUITS_S = "CSHD"
|
||||||
SUITS_RE = '[' + SUITS_S + ']'
|
SUITS_RE = '[' + SUITS_S + ']'
|
||||||
CARD_RE = r'(?:' + RANKS_RE + SUITS_RE + ')'
|
CARD_RE = r'(?:' + RANKS_RE + SUITS_RE + ')'
|
||||||
|
@ -868,7 +868,8 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
s_game.moveMove(1, game.talon, target, frames=0)
|
s_game.moveMove(1, game.talon, target, frames=0)
|
||||||
|
|
||||||
def put_str(target, str_):
|
def put_str(target, str_):
|
||||||
put(target, SUITS_S.index(str_[1]), RANKS_S.index(str_[0]))
|
put(target, SUITS_S.index(str_[-1]),
|
||||||
|
(RANKS_S.index(str_[0]) if len(str_) == 2 else 9))
|
||||||
|
|
||||||
def my_find_re(RE, m):
|
def my_find_re(RE, m):
|
||||||
s = m.group(1)
|
s = m.group(1)
|
||||||
|
@ -896,7 +897,12 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
for foundat in game.foundations:
|
for foundat in game.foundations:
|
||||||
suit = foundat.cap.suit
|
suit = foundat.cap.suit
|
||||||
if SUITS_S[suit] == gm[0]:
|
if SUITS_S[suit] == gm[0]:
|
||||||
for r in range(RANKS0_S.index(gm[1])):
|
rank = gm[1]
|
||||||
|
if len(rank) == 1:
|
||||||
|
lim = RANKS0_S.index(rank)
|
||||||
|
else:
|
||||||
|
lim = 10
|
||||||
|
for r in range(lim):
|
||||||
put(foundat, suit, r)
|
put(foundat, suit, r)
|
||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -1226,7 +1226,7 @@ Unsupported game for import.
|
||||||
if not idir:
|
if not idir:
|
||||||
idir = self.app.dn.savegames
|
idir = self.app.dn.savegames
|
||||||
d = tkinter_tkfiledialog.Open()
|
d = tkinter_tkfiledialog.Open()
|
||||||
if True:
|
if 'PYSOL_DEBUG_IMPORT' not in os.environ:
|
||||||
filename = d.show(filetypes=self.FILETYPES,
|
filename = d.show(filetypes=self.FILETYPES,
|
||||||
defaultextension=self.DEFAULTEXTENSION,
|
defaultextension=self.DEFAULTEXTENSION,
|
||||||
initialdir=idir, initialfile=ifile)
|
initialdir=idir, initialfile=ifile)
|
||||||
|
|
Loading…
Add table
Reference in a new issue