From 788965a55a80f647445e73e2d84787673f793b42 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 27 Dec 2017 15:24:08 +0200 Subject: [PATCH] sanity check --- pysollib/hint.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pysollib/hint.py b/pysollib/hint.py index 1c4ec724..72192ade 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -869,8 +869,11 @@ class FreeCellSolver_Hint(Base_Solver_Hint): continue m = re.match(r'^(?:FC:|Freecells:)\s*(.*)', line) if m: - g = re.findall( - r'\b(' + CARD_RE + r'|\-)\b', m.group(1)) + RE = r'(' + CARD_RE + r'|\-)' + s = m.group(1) + assert re.match(r'^\s*(?:' + RE + r')?(?:\s+' + + RE + r')*\s*$', s) + g = re.findall(r'\b' + RE + r'\b', s) while len(g) < len(game.reserves): g.append('-') for i, gm in enumerate(g):