Skip to content

Commit a9e2cf2

Browse files
committed
implmented MAKER
1 parent 712d4fb commit a9e2cf2

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

tests/test_maker.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import random
44
import re
5+
import sys
56
from collections import Counter
67
from typing import Optional
78

@@ -15,7 +16,7 @@
1516
from effectful.ops.semantics import handler
1617

1718

18-
@dataclass
19+
@dataclass(frozen=True)
1920
class Step:
2021
start: int
2122
end: int
@@ -267,7 +268,8 @@ def do_voting(self) -> Step: # algorithm 2
267268
):
268269
self.votes[vote] += 1
269270
max_other_votes = max(
270-
self.votes[o_vote] for o_vote in self.votes if o_vote != vote
271+
(self.votes[o_vote] for o_vote in self.votes if o_vote != vote),
272+
default=0,
271273
)
272274
if self.votes[vote] >= max_other_votes + self.k:
273275
return vote
@@ -303,11 +305,15 @@ def solve_hanoi(state: GameState):
303305
state.visualise()
304306

305307

306-
logging.basicConfig()
308+
logging.basicConfig(
309+
level=logging.INFO,
310+
stream=sys.stdout,
311+
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
312+
)
307313

308314
with (
309-
handler(ThreadPoolFuturesInterpretation(max_workers=3)),
310-
handler(LLMLoggingHandler()),
315+
handler(ThreadPoolFuturesInterpretation()),
311316
handler(OpenAIAPIProvider(OpenAI())),
317+
handler(LLMLoggingHandler()),
312318
):
313319
solve_hanoi(state=GameState.new(3))

0 commit comments

Comments
 (0)