Test case 3
Browse files
backend/__pycache__/solver.cpython-313.pyc
CHANGED
|
Binary files a/backend/__pycache__/solver.cpython-313.pyc and b/backend/__pycache__/solver.cpython-313.pyc differ
|
|
|
backend/solver.py
CHANGED
|
@@ -126,6 +126,8 @@ def solve_puzzle(index, puzzle, expected_solution, sys_content, sat_cnt_content)
|
|
| 126 |
stderr=subprocess.PIPE,
|
| 127 |
text=True
|
| 128 |
)
|
|
|
|
|
|
|
| 129 |
output = result.stdout.strip()
|
| 130 |
return output.lower()
|
| 131 |
|
|
@@ -144,7 +146,12 @@ def solve_puzzle(index, puzzle, expected_solution, sys_content, sat_cnt_content)
|
|
| 144 |
if "s.add" in line and "pos" in line:
|
| 145 |
constraint = line.strip()
|
| 146 |
cnt_cons += 1
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
ok_satisfied = False
|
| 149 |
problematic_constraints += f"In line {i + 1}, the {cnt_cons}-th constraint: {constraint}. Not satisfied.\n"
|
| 150 |
if ok_satisfied:
|
|
@@ -172,7 +179,7 @@ def solve_puzzle(index, puzzle, expected_solution, sys_content, sat_cnt_content)
|
|
| 172 |
# print("\n".join(code_by_line_experiment) + sat_cnt_content)
|
| 173 |
# print(res)
|
| 174 |
if not res or res == "error":
|
| 175 |
-
problematic_constraints += f"Unable to judge
|
| 176 |
else:
|
| 177 |
cur = int(res.split(':')[1])
|
| 178 |
problematic_constraints += f"The number of solutions: {cur}\n"
|
|
@@ -182,7 +189,7 @@ def solve_puzzle(index, puzzle, expected_solution, sys_content, sat_cnt_content)
|
|
| 182 |
code_by_line_experiment[i] = ""
|
| 183 |
res = run_result()
|
| 184 |
if not res or res == "error":
|
| 185 |
-
problematic_constraints += f"Unable to judge further
|
| 186 |
break
|
| 187 |
now_cnt = int(res.split(':')[1])
|
| 188 |
if now_cnt == cur:
|
|
|
|
| 126 |
stderr=subprocess.PIPE,
|
| 127 |
text=True
|
| 128 |
)
|
| 129 |
+
if result.stderr.strip():
|
| 130 |
+
return "error: " + result.stderr.strip()
|
| 131 |
output = result.stdout.strip()
|
| 132 |
return output.lower()
|
| 133 |
|
|
|
|
| 146 |
if "s.add" in line and "pos" in line:
|
| 147 |
constraint = line.strip()
|
| 148 |
cnt_cons += 1
|
| 149 |
+
output = satisfied(constraint)
|
| 150 |
+
if "error" in output:
|
| 151 |
+
problematic_constraints += f"In line {i + 1}, the {cnt_cons}-th constraint: {constraint}. Error: {output}.\n"
|
| 152 |
+
ok_satisfied = False
|
| 153 |
+
break
|
| 154 |
+
if output == "unsat":
|
| 155 |
ok_satisfied = False
|
| 156 |
problematic_constraints += f"In line {i + 1}, the {cnt_cons}-th constraint: {constraint}. Not satisfied.\n"
|
| 157 |
if ok_satisfied:
|
|
|
|
| 179 |
# print("\n".join(code_by_line_experiment) + sat_cnt_content)
|
| 180 |
# print(res)
|
| 181 |
if not res or res == "error":
|
| 182 |
+
problematic_constraints += f"Unable to judge."
|
| 183 |
else:
|
| 184 |
cur = int(res.split(':')[1])
|
| 185 |
problematic_constraints += f"The number of solutions: {cur}\n"
|
|
|
|
| 189 |
code_by_line_experiment[i] = ""
|
| 190 |
res = run_result()
|
| 191 |
if not res or res == "error":
|
| 192 |
+
problematic_constraints += f"Unable to judge further."
|
| 193 |
break
|
| 194 |
now_cnt = int(res.split(':')[1])
|
| 195 |
if now_cnt == cur:
|