Skip to content

Commit 2a9f112

Browse files
committed
adjusted feedback so it doesnt effectively just say answer to the user
1 parent 303b8ea commit 2a9f112

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

evaluation_function/evaluation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,17 @@ def evaluation_function(
123123
if not is_correct:
124124
feedback.append((
125125
"equivalence",
126-
f"Comparing your formula \"{response_formula}\" with expected \"{equivalent}\". They are not equivalent."
126+
"Your formula is not equivalent to the target."
127127
))
128128
if counterex:
129129
if counterex.get("reason"):
130130
feedback.append(("counterexample", counterex["reason"]))
131131
elif counterex.get("assignment") is not None:
132+
# Use plain atom names only (assignment is already name -> bool)
132133
asn = ", ".join(f"{k}={counterex['assignment'][k]}" for k in sorted(counterex["assignment"]))
133134
feedback.append((
134135
"counterexample",
135-
f"Under assignment ({asn}): your formula = {counterex['response_value']}, expected formula = {counterex['expected_value']}."
136+
f"Under assignment ({asn}) your formula evaluates to {counterex['response_value']}."
136137
))
137138
elif tautology:
138139
ev = TautologyEvaluator(formula)

evaluation_function/truth_table/evaluate.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def evaluate_truth_table(variables: list[str], cells: list[list[str]], num_atoms
7777
if atom not in existing_atoms:
7878
return Result(
7979
is_correct=False,
80-
feedback_items=[(Exception, f"in column {i+1}, atom {atom} in formula {formula_string} is undefined")]
80+
feedback_items=[(Exception, f"in column {i+1}, atom {atom.name} in formula {formula_string} is undefined")]
8181
)
8282

8383
# replace strings with
@@ -142,13 +142,9 @@ def evaluate_truth_table(variables: list[str], cells: list[list[str]], num_atoms
142142
expected = FormulaEvaluator(formula, assignment).evaluate()
143143
got = cells[i][j]
144144
if expected != got:
145-
formula_str = variables[j] if j < len(variables) else f"column {j+1}"
146145
return Result(
147146
is_correct=False,
148-
feedback_items=[(
149-
Exception,
150-
f"incorrect cell value at row {i+1}, column {j+1} (formula \"{formula_str}\"): expected {'T' if expected else 'F'}, got {'T' if got else 'F'}."
151-
)]
147+
feedback_items=[(Exception, "There is at least one incorrect cell value in the truth table.")]
152148
)
153149

154150

0 commit comments

Comments
 (0)