From 00ded37a0ed24197e009f00dc0724f7b4283dc62 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 27 Dec 2017 14:31:41 +0200 Subject: [PATCH] Extract more. --- pysollib/hint.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pysollib/hint.py b/pysollib/hint.py index 19c1a087..c967d577 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -827,7 +827,9 @@ class FreeCellSolver_Hint(Base_Solver_Hint): RANKS_S = "A23456789TJQK" RANKS0_S = '0' + RANKS_S RANKS_RE = '[' + RANKS_S + ']' - CARD_RE = RANKS_RE + '[CSHD]' + SUITS_S = "CSHD" + SUITS_RE = '[' + SUITS_S + ']' + CARD_RE = RANKS_RE + SUITS_RE def cards(): return game.talon.cards @@ -843,14 +845,15 @@ class FreeCellSolver_Hint(Base_Solver_Hint): s_game.moveMove(1, game.talon, target, frames=0) def put_str(target, str_): - put(target, "CSHD".index(str_[1]), RANKS_S.index(str_[0])) + put(target, SUITS_S.index(str_[1]), RANKS_S.index(str_[0])) for line_p in fh: line = line_p.rstrip('\r\n') m = re.match(r'^(?:Foundations:|Founds?:)\s*(.*)', line) if m: - g = re.findall(r'\b([HCDS])-([' + RANKS0_S + r'])\b', - m.group(1)) + g = re.findall( + r'\b(' + SUITS_RE + r')-([' + RANKS0_S + r'])\b', + m.group(1)) for gm in g: for foundat in game.foundations: suit = foundat.cap.suit