fix: a star in docs

This commit is contained in:
zsq259
2024-06-25 15:51:24 +08:00
parent 1b3eba4657
commit 4c3e84486d
173 changed files with 10755 additions and 6 deletions

1
logic/test_cases/CONFIG Normal file
View File

@ -0,0 +1 @@
order: "q1 q2 q3 q4 q5 q6 q7 q8"

View File

@ -0,0 +1,2 @@
class: "PassAllTestsQuestion"
max_points: "2"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/correctSentence1.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "((A | B) & (~A <=> (~B | C)) & (~A | ~B | C))"

View File

@ -0,0 +1,9 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.sentence1()"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/correctSentence2.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "((C <=> (B | D)) & (A >> (~B & ~D)) & (~(B & ~C) >> A) & (~D >> C))"

View File

@ -0,0 +1,9 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.sentence2()"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/correctSentence3.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "((PacmanAlive_1 <=> ((PacmanAlive_0 & ~PacmanKilled_0) | (~PacmanAlive_0 & PacmanBorn_0))) & ~(PacmanAlive_0 & PacmanBorn_0) & PacmanBorn_0)"

View File

@ -0,0 +1,9 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.sentence3()"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/entails.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "True True False True True False"

View File

@ -0,0 +1,22 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
ans = [logicPlan.entails(A & B, A), logicPlan.entails(A & B, A | B), logicPlan.entails(A | B, A), logicPlan.entails(~(A & B & C & D), ~A | ~B | ~C | ~D), logicPlan.entails(A >> B, B | ~A), logicPlan.entails(A >> B, A)]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/findModelSentence1.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "[(A, False), (B, True), (C, True)]"

View File

@ -0,0 +1,10 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.modelToString(logicPlan.findModel(logicPlan.sentence1()))"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/findModelSentence2.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "False"

View File

@ -0,0 +1,9 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.modelToString(logicPlan.findModel(logicPlan.sentence2()))"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/findModelSentence3.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "[(PacmanAlive_0, False), (PacmanAlive_1, True), (PacmanBorn_0, True), (PacmanKilled_0, False)]"

View File

@ -0,0 +1,9 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.modelToString(logicPlan.findModel(logicPlan.sentence3()))"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/findModelUnderstandingCheck.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "[(a, True)]"

View File

@ -0,0 +1,10 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logicPlan.modelToString(logicPlan.findModelUnderstandingCheck())"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/plTrueInverse.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "[(A, True)] does not satisfy ~A : True. [(A, True)] does not satisfy A : False. [(A, False), (B, True)] does not satisfy ~(A >> B) : True. [(A, False), (B, True)] does not satisfy (A >> B) : False. [(A, False), (B, True), (C, True)] does not satisfy ~((A | B) & (~A <=> (~B | C)) & (~A | ~B | C)) : True. [(A, False), (B, True), (C, True)] does not satisfy ((A | B) & (~A <=> (~B | C)) & (~A | ~B | C)) : False. [(PacmanAlive_0, False), (PacmanAlive_1, True), (PacmanBorn_0, True), (PacmanKilled_0, False)] does not satisfy ~((PacmanAlive_1 <=> ((PacmanAlive_0 & ~PacmanKilled_0) | (~PacmanAlive_0 & PacmanBorn_0))) & ~(PacmanAlive_0 & PacmanBorn_0) & PacmanBorn_0) : True. [(PacmanAlive_0, False), (PacmanAlive_1, True), (PacmanBorn_0, True), (PacmanKilled_0, False)] does not satisfy ((PacmanAlive_1 <=> ((PacmanAlive_0 & ~PacmanKilled_0) | (~PacmanAlive_0 & PacmanBorn_0))) & ~(PacmanAlive_0 & PacmanBorn_0) & PacmanBorn_0) : False. "

View File

@ -0,0 +1,30 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
from logicPlan import plTrueInverse, findModel, sentence1, sentence3, modelToString
A = logic.PropSymbolExpr('A')
B = logic.PropSymbolExpr('B')
results = {}
for expr in [A, A >> B, sentence1(), sentence3()]:
model = findModel(expr)
results[~expr] = plTrueInverse(model, ~expr), model
results[expr] = plTrueInverse(model, expr), model
ans = ''
for key, value in results.items():
ans += modelToString(value[1]) + ' does not satisfy ' + repr(key) + ' : ' + str(value[0]) + '. '
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,2 @@
class: "PassAllTestsQuestion"
max_points: "2"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/atLeastOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "False True True"

View File

@ -0,0 +1,33 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
atleast1 = logicPlan.atLeastOne(symbols)
model1 = {A:False, B:False, C:False, D:False}
model2 = {A:False, B:True, C:False, D:False}
model3 = {A:True, B:True, C:False, D:False}
ans1 = logic.pl_true(atleast1,model1)
ans2 = logic.pl_true(atleast1,model2)
ans3 = logic.pl_true(atleast1,model3)
ans = [ans1, ans2, ans3]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/atLeastOneCNF.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "True"

View File

@ -0,0 +1,20 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.Expr('A')
B = logic.Expr('B')
C = logic.Expr('C')
D = logic.Expr('D')
expr = logicPlan.atLeastOne([A, B, C, D])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logic.is_valid_cnf(expr)"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/atLeastOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "1"

View File

@ -0,0 +1,25 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
logic.Expr.counter = 0
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
atleast1 = logicPlan.atLeastOne(symbols)
num_nodes = logic.Expr.counter
ans = [num_nodes]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/atMostOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "True True False"

View File

@ -0,0 +1,32 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
atmost1 = logicPlan.atMostOne(symbols)
model1 = {A:False, B:False, C:False, D:False}
model2 = {A:False, B:True, C:False, D:False}
model3 = {A:False, B:True, C:False, D:True}
ans1 = logic.pl_true(atmost1,model1)
ans2 = logic.pl_true(atmost1,model2)
ans3 = logic.pl_true(atmost1,model3)
ans = [ans1, ans2, ans3]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/atMostOneCNF.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "True"

View File

@ -0,0 +1,20 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.Expr('A')
B = logic.Expr('B')
C = logic.Expr('C')
D = logic.Expr('D')
expr = logicPlan.atMostOne([A, B, C, D])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logic.is_valid_cnf(expr)"

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q2/atMostOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "19"
result0: "11"

View File

@ -0,0 +1,26 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
logic.Expr.counter = 0
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
atmost1 = logicPlan.atMostOne(symbols)
num_nodes = logic.Expr.counter
ans = [num_nodes]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/exactlyOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "False True False"

View File

@ -0,0 +1,33 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
exactly1 = logicPlan.exactlyOne(symbols)
model1 = {A:False, B:False, C:False, D:False}
model2 = {A:False, B:True, C:False, D:False}
model3 = {A:False, B:True, C:False, D:True}
ans1 = logic.pl_true(exactly1,model1)
ans2 = logic.pl_true(exactly1,model2)
ans3 = logic.pl_true(exactly1,model3)
ans = [ans1, ans2, ans3]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/exactlyOneCNF.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "True"

View File

@ -0,0 +1,20 @@
class: "EvalTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
A = logic.Expr('A')
B = logic.Expr('B')
C = logic.Expr('C')
D = logic.Expr('D')
expr = logicPlan.exactlyOne([A, B, C, D])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "logic.is_valid_cnf(expr)"

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q2/exactlyOne.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "21"
result0: "13"

View File

@ -0,0 +1,27 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import logic
logic.Expr.counter = 0
A = logic.PropSymbolExpr('A');
B = logic.PropSymbolExpr('B');
C = logic.PropSymbolExpr('C');
D = logic.PropSymbolExpr('D');
symbols = [A, B, C, D]
exactly1 = logicPlan.exactlyOne(symbols)
num_nodes = logic.Expr.counter
ans = [num_nodes]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "4"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases\q3\pacphysics_satisfiability3.test.
model_not_at_x1_y1_1: "False"
model_at_x1_y1_1: "[(East_0, False), (East_1, False), (North_0, True), (North_1, False), (P[0,0]_0, False), (P[0,0]_1, False), (P[0,1]_0, False), (P[0,1]_1, False), (P[0,2]_0, False), (P[0,2]_1, False), (P[0,3]_0, False), (P[0,3]_1, False), (P[1,0]_0, False), (P[1,0]_1, False), (P[1,1]_0, True), (P[1,1]_1, False), (P[1,2]_0, False), (P[1,2]_1, True), (P[1,3]_0, False), (P[1,3]_1, False), (P[2,0]_0, False), (P[2,0]_1, False), (P[2,1]_0, False), (P[2,1]_1, False), (P[2,2]_0, False), (P[2,2]_1, False), (P[2,3]_0, False), (P[2,3]_1, False), (South_0, False), (South_1, True), (WALL[0,0], True), (WALL[0,1], True), (WALL[0,2], True), (WALL[0,3], True), (WALL[1,0], True), (WALL[1,1], False), (WALL[1,2], False), (WALL[1,3], True), (WALL[2,0], True), (WALL[2,1], True), (WALL[2,2], True), (WALL[2,3], True), (West_0, False), (West_1, False)]"

View File

@ -0,0 +1,14 @@
class: "LocationSatisfiabilityTest"
layoutName: "maze1x2"
layout: """
%%%
% %
%P%
%%%
"""
x0_y0: "(1, 1)"
action0: "North"
x1_y1: "(1, 2)"
action1: "South"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases\q3\pacphysics_satisfiability4.test.
model_not_at_x1_y1_1: "[(East_0, False), (East_1, True), (North_0, False), (North_1, False), (P[0,0]_0, False), (P[0,0]_1, False), (P[0,1]_0, False), (P[0,1]_1, False), (P[0,2]_0, False), (P[0,2]_1, False), (P[0,3]_0, False), (P[0,3]_1, False), (P[0,4]_0, False), (P[0,4]_1, False), (P[1,0]_0, False), (P[1,0]_1, False), (P[1,1]_0, False), (P[1,1]_1, False), (P[1,2]_0, False), (P[1,2]_1, True), (P[1,3]_0, False), (P[1,3]_1, False), (P[1,4]_0, False), (P[1,4]_1, False), (P[2,0]_0, False), (P[2,0]_1, False), (P[2,1]_0, False), (P[2,1]_1, False), (P[2,2]_0, True), (P[2,2]_1, False), (P[2,3]_0, False), (P[2,3]_1, False), (P[2,4]_0, False), (P[2,4]_1, False), (P[3,0]_0, False), (P[3,0]_1, False), (P[3,1]_0, False), (P[3,1]_1, False), (P[3,2]_0, False), (P[3,2]_1, False), (P[3,3]_0, False), (P[3,3]_1, False), (P[3,4]_0, False), (P[3,4]_1, False), (P[4,0]_0, False), (P[4,0]_1, False), (P[4,1]_0, False), (P[4,1]_1, False), (P[4,2]_0, False), (P[4,2]_1, False), (P[4,3]_0, False), (P[4,3]_1, False), (P[4,4]_0, False), (P[4,4]_1, False), (South_0, False), (South_1, False), (WALL[0,0], True), (WALL[0,1], True), (WALL[0,2], True), (WALL[0,3], True), (WALL[0,4], True), (WALL[1,0], True), (WALL[1,1], True), (WALL[1,2], False), (WALL[1,3], True), (WALL[1,4], True), (WALL[2,0], True), (WALL[2,1], False), (WALL[2,2], False), (WALL[2,3], False), (WALL[2,4], True), (WALL[3,0], True), (WALL[3,1], True), (WALL[3,2], False), (WALL[3,3], True), (WALL[3,4], True), (WALL[4,0], True), (WALL[4,1], True), (WALL[4,2], True), (WALL[4,3], True), (WALL[4,4], True), (West_0, True), (West_1, False)]"
model_at_x1_y1_1: "False"

View File

@ -0,0 +1,15 @@
class: "LocationSatisfiabilityTest"
layoutName: "maze3x3_5_cross"
layout: """
%%%%%
%% %%
% P %
%% %%
%%%%%
"""
x0_y0: "(2, 2)"
action0: "West"
x1_y1: "(3, 2)"
action1: "East"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases\q3\pacphysics_satisfiability1.test.
pacphysicsAxioms: "((WALL[0,0] >> ~P[0,0]_0) & (WALL[0,1] >> ~P[0,1]_0) & (WALL[0,2] >> ~P[0,2]_0) & (WALL[0,3] >> ~P[0,3]_0) & (WALL[1,0] >> ~P[1,0]_0) & (WALL[1,1] >> ~P[1,1]_0) & (WALL[1,2] >> ~P[1,2]_0) & (WALL[1,3] >> ~P[1,3]_0) & (WALL[2,0] >> ~P[2,0]_0) & (WALL[2,1] >> ~P[2,1]_0) & (WALL[2,2] >> ~P[2,2]_0) & (WALL[2,3] >> ~P[2,3]_0) & (P[1,1]_0 | P[1,2]_0) & (~P[1,1]_0 | ~P[1,2]_0) & (North_0 | South_0 | East_0 | West_0) & (~North_0 | ~South_0) & (~North_0 | ~East_0) & (~North_0 | ~West_0) & (~South_0 | ~East_0) & (~South_0 | ~West_0) & (~East_0 | ~West_0) & (NORTH_BLOCKED_0 <=> (PWALL[1,1,1,2]_0 | PWALL[1,2,1,3]_0)) & (SOUTH_BLOCKED_0 <=> (PWALL[1,1,1,0]_0 | PWALL[1,2,1,1]_0)) & (EAST_BLOCKED_0 <=> (PWALL[1,1,2,1]_0 | PWALL[1,2,2,2]_0)) & (WEST_BLOCKED_0 <=> (PWALL[1,1,0,1]_0 | PWALL[1,2,0,2]_0)) & (PWALL[1,1,1,2]_0 <=> (P[1,1]_0 & WALL[1,2])) & (PWALL[1,2,1,3]_0 <=> (P[1,2]_0 & WALL[1,3])) & (PWALL[1,1,1,0]_0 <=> (P[1,1]_0 & WALL[1,0])) & (PWALL[1,2,1,1]_0 <=> (P[1,2]_0 & WALL[1,1])) & (PWALL[1,1,2,1]_0 <=> (P[1,1]_0 & WALL[2,1])) & (PWALL[1,2,2,2]_0 <=> (P[1,2]_0 & WALL[2,2])) & (PWALL[1,1,0,1]_0 <=> (P[1,1]_0 & WALL[0,1])) & (PWALL[1,2,0,2]_0 <=> (P[1,2]_0 & WALL[0,2])))"

View File

@ -0,0 +1,12 @@
class: "PacphysicsTest"
layoutName: "maze1x2"
layout: """
%%%
% %
%P%
%%%
"""
t: "0"
axiomType: "sensor"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases\q3\pacphysics_satisfiability2.test.
pacphysicsAxioms: "((WALL[0,0] >> ~P[0,0]_1) & (WALL[0,1] >> ~P[0,1]_1) & (WALL[0,2] >> ~P[0,2]_1) & (WALL[0,3] >> ~P[0,3]_1) & (WALL[1,0] >> ~P[1,0]_1) & (WALL[1,1] >> ~P[1,1]_1) & (WALL[1,2] >> ~P[1,2]_1) & (WALL[1,3] >> ~P[1,3]_1) & (WALL[2,0] >> ~P[2,0]_1) & (WALL[2,1] >> ~P[2,1]_1) & (WALL[2,2] >> ~P[2,2]_1) & (WALL[2,3] >> ~P[2,3]_1) & (WALL[3,0] >> ~P[3,0]_1) & (WALL[3,1] >> ~P[3,1]_1) & (WALL[3,2] >> ~P[3,2]_1) & (WALL[3,3] >> ~P[3,3]_1) & (P[1,1]_1 | P[1,2]_1 | P[2,1]_1 | P[2,2]_1) & (~P[1,1]_1 | ~P[1,2]_1) & (~P[1,1]_1 | ~P[2,1]_1) & (~P[1,1]_1 | ~P[2,2]_1) & (~P[1,2]_1 | ~P[2,1]_1) & (~P[1,2]_1 | ~P[2,2]_1) & (~P[2,1]_1 | ~P[2,2]_1) & (North_1 | South_1 | East_1 | West_1) & (~North_1 | ~South_1) & (~North_1 | ~East_1) & (~North_1 | ~West_1) & (~South_1 | ~East_1) & (~South_1 | ~West_1) & (~East_1 | ~West_1) & (NORTH_BLOCKED_1 <=> (PWALL[1,1,1,2]_1 | PWALL[1,2,1,3]_1 | PWALL[2,1,2,2]_1 | PWALL[2,2,2,3]_1)) & (SOUTH_BLOCKED_1 <=> (PWALL[1,1,1,0]_1 | PWALL[1,2,1,1]_1 | PWALL[2,1,2,0]_1 | PWALL[2,2,2,1]_1)) & (EAST_BLOCKED_1 <=> (PWALL[1,1,2,1]_1 | PWALL[1,2,2,2]_1 | PWALL[2,1,3,1]_1 | PWALL[2,2,3,2]_1)) & (WEST_BLOCKED_1 <=> (PWALL[1,1,0,1]_1 | PWALL[1,2,0,2]_1 | PWALL[2,1,1,1]_1 | PWALL[2,2,1,2]_1)) & (PWALL[1,1,1,2]_1 <=> (P[1,1]_1 & WALL[1,2])) & (PWALL[1,2,1,3]_1 <=> (P[1,2]_1 & WALL[1,3])) & (PWALL[2,1,2,2]_1 <=> (P[2,1]_1 & WALL[2,2])) & (PWALL[2,2,2,3]_1 <=> (P[2,2]_1 & WALL[2,3])) & (PWALL[1,1,1,0]_1 <=> (P[1,1]_1 & WALL[1,0])) & (PWALL[1,2,1,1]_1 <=> (P[1,2]_1 & WALL[1,1])) & (PWALL[2,1,2,0]_1 <=> (P[2,1]_1 & WALL[2,0])) & (PWALL[2,2,2,1]_1 <=> (P[2,2]_1 & WALL[2,1])) & (PWALL[1,1,2,1]_1 <=> (P[1,1]_1 & WALL[2,1])) & (PWALL[1,2,2,2]_1 <=> (P[1,2]_1 & WALL[2,2])) & (PWALL[2,1,3,1]_1 <=> (P[2,1]_1 & WALL[3,1])) & (PWALL[2,2,3,2]_1 <=> (P[2,2]_1 & WALL[3,2])) & (PWALL[1,1,0,1]_1 <=> (P[1,1]_1 & WALL[0,1])) & (PWALL[1,2,0,2]_1 <=> (P[1,2]_1 & WALL[0,2])) & (PWALL[2,1,1,1]_1 <=> (P[2,1]_1 & WALL[1,1])) & (PWALL[2,2,1,2]_1 <=> (P[2,2]_1 & WALL[1,2])) & (GEQ_1_adj_walls_1 <=> (NORTH_BLOCKED_1 | SOUTH_BLOCKED_1 | EAST_BLOCKED_1 | WEST_BLOCKED_1)) & (GEQ_2_adj_walls_1 <=> ((NORTH_BLOCKED_1 & SOUTH_BLOCKED_1) | (NORTH_BLOCKED_1 & EAST_BLOCKED_1) | (NORTH_BLOCKED_1 & WEST_BLOCKED_1) | (SOUTH_BLOCKED_1 & EAST_BLOCKED_1) | (SOUTH_BLOCKED_1 & WEST_BLOCKED_1) | (EAST_BLOCKED_1 & WEST_BLOCKED_1))) & (GEQ_3_adj_walls_1 <=> ((NORTH_BLOCKED_1 & SOUTH_BLOCKED_1 & EAST_BLOCKED_1) | (NORTH_BLOCKED_1 & SOUTH_BLOCKED_1 & WEST_BLOCKED_1) | (NORTH_BLOCKED_1 & EAST_BLOCKED_1 & WEST_BLOCKED_1) | (SOUTH_BLOCKED_1 & EAST_BLOCKED_1 & WEST_BLOCKED_1))) & (P[1,1]_1 <=> ((~P[1,1]_0 & ~WALL[1,1] & ((P[1,2]_0 & South_0) | (P[2,1]_0 & West_0))) | (P[1,1]_0 & (WALLNorth[1,2]_0 | WALLSouth[1,0]_0 | WALLEast[2,1]_0 | WALLWest[0,1]_0)))) & (WALLNorth[1,2]_0 <=> (WALL[1,2] & North_0)) & (WALLSouth[1,0]_0 <=> (WALL[1,0] & South_0)) & (WALLEast[2,1]_0 <=> (WALL[2,1] & East_0)) & (WALLWest[0,1]_0 <=> (WALL[0,1] & West_0)) & (P[1,2]_1 <=> ((~P[1,2]_0 & ~WALL[1,2] & P[2,2]_0 & West_0) | (P[1,2]_0 & (WALLNorth[1,3]_0 | WALLSouth[1,1]_0 | WALLEast[2,2]_0 | WALLWest[0,2]_0)))) & (WALLNorth[1,3]_0 <=> (WALL[1,3] & North_0)) & (WALLSouth[1,1]_0 <=> (WALL[1,1] & South_0)) & (WALLEast[2,2]_0 <=> (WALL[2,2] & East_0)) & (WALLWest[0,2]_0 <=> (WALL[0,2] & West_0)) & (P[2,1]_1 <=> ((~P[2,1]_0 & ~WALL[2,1] & P[2,2]_0 & South_0) | (P[2,1]_0 & (WALLNorth[2,2]_0 | WALLSouth[2,0]_0 | WALLEast[3,1]_0 | WALLWest[1,1]_0)))) & (WALLNorth[2,2]_0 <=> (WALL[2,2] & North_0)) & (WALLSouth[2,0]_0 <=> (WALL[2,0] & South_0)) & (WALLEast[3,1]_0 <=> (WALL[3,1] & East_0)) & (WALLWest[1,1]_0 <=> (WALL[1,1] & West_0)) & (P[2,2]_1 <=> ((~P[2,2]_0 & ~WALL[2,2] & ((P[2,1]_0 & North_0) | (P[1,2]_0 & East_0))) | (P[2,2]_0 & (WALLNorth[2,3]_0 | WALLSouth[2,1]_0 | WALLEast[3,2]_0 | WALLWest[1,2]_0)))) & (WALLNorth[2,3]_0 <=> (WALL[2,3] & North_0)) & (WALLSouth[2,1]_0 <=> (WALL[2,1] & South_0)) & (WALLEast[3,2]_0 <=> (WALL[3,2] & East_0)) & (WALLWest[1,2]_0 <=> (WALL[1,2] & West_0)))"

View File

@ -0,0 +1,11 @@
class: "PacphysicsTest"
layoutName: "maze2x2_3"
layout: """
%%%%
% P%
%% %
%%%%
"""
t: "1"
axiomType: "slam"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q3/pacphysics_transition.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "(P[1,1]_1 <=> ((P[1,2]_0 & South_0) | (P[1,0]_0 & North_0) | (P[2,1]_0 & West_0) | (P[0,1]_0 & East_0))) (P[1,1]_2 <=> ((P[1,2]_1 & South_1) | (P[1,0]_1 & North_1) | (P[2,1]_1 & West_1) | (P[0,1]_1 & East_1))) (P[1,1]_1 <=> ((P[1,2]_0 & South_0) | (P[2,1]_0 & West_0))) None"

View File

@ -0,0 +1,23 @@
class: "LogicTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
from logicPlan import pacmanSuccessorAxiomSingle
psas = pacmanSuccessorAxiomSingle
grid1 = [[0]*3]*3 # no walls; note that the three lists are the same reference
grid2 = [[1]*4, [1, 0, 0, 1], [1, 0, 1, 1], [1]*4] # 2x2 inside
grid3 = [[1]*3]*3 # all walls; note that the three lists are the same reference
ans = [psas(1, 1, 1, grid1), psas(1, 1, 2, grid1), psas(1, 1, 1, grid2), psas(1, 1, 2, grid3)]
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "3"

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q4/positionLogicPlan1.test.
solution_win: "True"
solution_score: "508"
solution_path: "West South"

View File

@ -0,0 +1,11 @@
class: "PositionProblemTest"
layoutName: "maze2x2"
layout: """
%%%%
% P%
%. %
%%%%
"""

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q4/positionLogicPlan2.test.
solution_win: "True"
solution_score: "502"
solution_path: "South South West South West West South West"

View File

@ -0,0 +1,14 @@
class: "PositionProblemTest"
layoutName: "tinyMaze"
layout: """
%%%%%%%
% P%
% %%% %
% % %
%% %%
%. %%%%
%%%%%%%
"""

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q4/positionLogicPlan3.test.
solution_win: "True"
solution_score: "491"
solution_path: "East East South South West South South West West South West West West West West West West West West"

View File

@ -0,0 +1,17 @@
class: "PositionProblemTest"
layoutName: "smallMaze"
layout: """
%%%%%%%%%%%%%%%%%%%%%%
% %% % % %
% %%%%%% % %%%%%% %
%%%%%% P % %
% % %%%%%% %% %%%%%
% %%%% % % %
% %%% %%% % %
%%%%%%%%%% %%%%%% %
%. %% %
%%%%%%%%%%%%%%%%%%%%%%
"""

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "3"

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q5/foodLogicPlan1.test.
solution_win: "True"
solution_score: "513"
solution_path: "West East East South South West West East"

View File

@ -0,0 +1,12 @@
class: "FoodProblemTest"
layoutName: "testSearch"
layout: """
%%%%%
%.P %
%%% %
%. %
%%%%%
"""

View File

@ -0,0 +1,4 @@
# This is the solution file for test_cases/q5/foodLogicPlan2.test.
solution_win: "True"
solution_score: "573"
solution_path: "South South West East East East East North North North North West West West West West West East East East South South West West West South South West"

View File

@ -0,0 +1,14 @@
class: "FoodProblemTest"
layoutName: "tinySearch"
layout: """
%%%%%%%%%
%.. ..%
%%%%.%% %
% P %
%.%% %%.%
%.%. .%
%%%%%%%%%
"""

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "4"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases/q6/localizationLogic1.test.
possible_locations_per_timestep: "[[(3, 1), (3, 3)], [(2, 3)], [(3, 3)], [(2, 3)], [(2, 2)]]"

View File

@ -0,0 +1,11 @@
class: "LocalizationProblemTest"
layoutName: "maze3x3_6"
layout: """
%%%%%
%% P%
% %%
%% %
%%%%%
"""
actions: "['West', 'East', 'West', 'South', 'North']"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases/q6/localizationLogic2.test.
possible_locations_per_timestep: "[[(1, 4), (3, 4)], [(1, 3), (3, 3)], [(1, 2), (3, 2)], [(3, 1)]]"

View File

@ -0,0 +1,12 @@
class: "LocalizationProblemTest"
layoutName: "maze3x4_9"
layout: """
%%%%%
% %P%
% % %
% % %
% %
%%%%%
"""
actions: "['South', 'South', 'South', 'West']"

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "3"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases/q7/mappingLogic1.test.
known_map_per_timestep: "[[[1, 1, 1, 1, 1], [1, -1, -1, -1, 1], [1, -1, -1, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, -1, -1, 1, 1], [1, -1, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, -1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]]"

View File

@ -0,0 +1,11 @@
class: "MappingProblemTest"
layoutName: "maze3x3_6"
layout: """
%%%%%
%% P%
% %%
%% %
%%%%%
"""
actions: "['West', 'South', 'West', 'East', 'South', 'East']"

View File

@ -0,0 +1,2 @@
# This is the solution file for test_cases/q7/mappingLogic2.test.
known_map_per_timestep: "[[[1, 1, 1, 1, 1, 1], [1, -1, -1, 0, 0, 1], [1, -1, -1, -1, 1, 1], [1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, 0, 0, 0, 1], [1, -1, -1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, -1, 0, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1], [1, 1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1], [1, 1, 0, -1, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1], [1, 1, 0, 0, -1, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]]"

View File

@ -0,0 +1,12 @@
class: "MappingProblemTest"
layoutName: "maze4x4_10"
layout: """
%%%%%
%P% %
% % %
% %
% %%
%%%%%
"""
actions: "['South', 'South', 'South', 'East', 'North', 'East', 'North', 'North']"

View File

@ -0,0 +1,2 @@
class: "PercentPassedQuestion"
max_points: "4"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q8/SLAMLogic1.test.
known_map_per_timestep: "[[[1, 1, 1, 1, 1], [1, -1, -1, -1, 1], [1, -1, -1, -1, 1], [1, -1, -1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, -1, -1, -1, 1], [1, -1, -1, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, -1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, -1, 1, 0, 1], [1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]]"
possible_locations_per_timestep: "[[(3, 3)], [(2, 3)], [(2, 2)], [(1, 2)], [(2, 2)], [(2, 1)]]"

View File

@ -0,0 +1,11 @@
class: "SLAMProblemTest"
layoutName: "maze3x3_6"
layout: """
%%%%%
%% P%
% %%
%% %
%%%%%
"""
actions: "['West', 'South', 'West', 'East', 'South', 'East']"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q8/SLAMLogic2.test.
known_map_per_timestep: "[[[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, 0, 1, 0, 1], [1, -1, -1, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, -1, -1, -1, -1, 1], [1, -1, -1, -1, 0, 1], [1, -1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1], [1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1]]]"
possible_locations_per_timestep: "[[(4, 4)], [(3, 4)], [(2, 4), (3, 4)], [(1, 4), (2, 4), (3, 4)], [(1, 3), (2, 3), (3, 3)], [(1, 2), (2, 2), (2, 3), (3, 3)], [(1, 1), (1, 2), (2, 1), (2, 2), (2, 3), (3, 3)], [(2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (4, 3)], [(3, 1), (3, 2), (4, 2)], [(3, 2), (4, 3)], [(4, 2)]]"

View File

@ -0,0 +1,12 @@
class: "SLAMProblemTest"
layoutName: "maze4x4_13"
layout: """
%%%%%%
% P%
% %% %
% % %
% %
%%%%%%
"""
actions: "['West', 'West', 'West', 'South', 'South', 'South', 'East', 'East', 'North', 'East', 'North']"