From 71ffeac967944bfd4f61d1f5724c8aed9d6d35a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 14 May 2015 10:50:34 +0200 Subject: Fix problems with configurations genration --- scripts/solution.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'scripts/solution.py') diff --git a/scripts/solution.py b/scripts/solution.py index 1ee1664..61cf65c 100644 --- a/scripts/solution.py +++ b/scripts/solution.py @@ -70,22 +70,21 @@ def generate(): if conf.picosat_output: print(line, end="") if line[0] == 's': - if line.rstrip() == 's SATISFIABLE': - try: - solut.remove(0) - with open(sf(conf.config_map_file), 'a') as fm: - fm.write(str(utils.hash_config(solut)) + ':') - for sl in solut: - fm.write(str(sl) + ' ') - fm.write('\n') - with open(sf(conf.solved_file), 'a') as fs: - for sl in solut: - fs.write(str(-1 * sl) + ' ') - fs.write('\n') - except ValueError: - pass - solut = [] - else: + try: + solut.remove(0) + with open(sf(conf.config_map_file), 'a') as fm: + fm.write(str(utils.hash_config(solut)) + ':') + for sl in solut: + fm.write(str(sl) + ' ') + fm.write('\n') + with open(sf(conf.solved_file), 'a') as fs: + for sl in solut: + fs.write(str(-1 * sl) + ' ') + fs.write('\n') + except ValueError: + pass + solut = [] + if not line.rstrip() == 's SATISFIABLE': os.remove(w_file.name) raise exceptions.NoSolution() elif line[0] == 'v': -- cgit v1.2.3