-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌴 Naive solver: Duet fixes, add tests
- Loading branch information
Showing
6 changed files
with
150 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
[tool.poetry] | ||
name = "codenames-solvers" | ||
version = "1.8.0" | ||
version = "1.8.1" | ||
description = "Solvers implementation for Codenames board game in python." | ||
authors = ["Michael Kali <[email protected]>", "Asaf Kali <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from codenames.duet.player import DuetPlayer, DuetTeam | ||
from codenames.generic.board import Board | ||
from codenames.generic.move import Clue, GivenClue, GivenGuess, Guess | ||
from codenames.generic.player import Operative, Spymaster | ||
from codenames.generic.state import OperativeState, SpymasterState | ||
|
||
|
||
class UnifiedDuetPlayer(DuetPlayer): | ||
def __init__(self, name: str, spymaster: Spymaster, operative: Operative): | ||
super().__init__(name, team=DuetTeam.MAIN) | ||
self.spymaster = spymaster | ||
self.operative = operative | ||
|
||
def give_clue(self, game_state: SpymasterState) -> Clue: | ||
return self.spymaster.give_clue(game_state) | ||
|
||
def guess(self, game_state: OperativeState) -> Guess: | ||
return self.operative.guess(game_state) | ||
|
||
def on_game_start(self, board: Board): | ||
self.spymaster.on_game_start(board) | ||
self.operative.on_game_start(board) | ||
|
||
def on_clue_given(self, given_clue: GivenClue): | ||
self.spymaster.on_clue_given(given_clue) | ||
self.operative.on_clue_given(given_clue) | ||
|
||
def on_guess_given(self, given_guess: GivenGuess): | ||
self.spymaster.on_guess_given(given_guess) | ||
self.operative.on_guess_given(given_guess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters