chore: Code cleanup

This commit is contained in:
Leni Aniva 2024-06-03 23:57:48 -07:00
parent 07597c0ce6
commit 860b3c2134
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@ from typing import override, Optional
import collections, unittest import collections, unittest
from pantograph.server import Server, TacticFailure from pantograph.server import Server, TacticFailure
from pantograph.expr import Expr, Tactic, Goal, GoalState from pantograph.expr import Expr, Tactic, GoalState
@dataclass @dataclass
@ -27,7 +27,6 @@ class SearchState:
return all(self.solved) return all(self.solved)
class Agent: class Agent:
def next_tactic(self, state: GoalState, goal_id: int) -> Optional[Tactic]: def next_tactic(self, state: GoalState, goal_id: int) -> Optional[Tactic]:
@ -121,6 +120,7 @@ class Agent:
self.reset() self.reset()
return False return False
class DumbAgent(Agent): class DumbAgent(Agent):
def __init__(self): def __init__(self):
@ -159,6 +159,7 @@ class DumbAgent(Agent):
self.goal_tactic_id_map[key] = i + 1 self.goal_tactic_id_map[key] = i + 1
return tactics[i] return tactics[i]
class TestSearch(unittest.TestCase): class TestSearch(unittest.TestCase):
def test_solve(self): def test_solve(self):
@ -175,5 +176,6 @@ class TestSearch(unittest.TestCase):
flag = agent.search(server=server, target="∀ (p q: Prop), Or p q -> Or q p", verbose=True) flag = agent.search(server=server, target="∀ (p q: Prop), Or p q -> Or q p", verbose=True)
self.assertTrue(flag) self.assertTrue(flag)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()