diff options
Diffstat (limited to 'scripts/solution.py')
-rw-r--r-- | scripts/solution.py | 31 |
1 files changed, 15 insertions, 16 deletions
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': |