Skip to content

Commit

Permalink
📜 README: Example fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf-kali committed Jan 10, 2025
1 parent 81587d9 commit 9a0b85b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,29 @@ import logging
import sys

from codenames.classic.board import ClassicBoard
from codenames.classic.team import ClassicTeam
from codenames.classic.player import ClassicOperative, ClassicSpymaster
from codenames.classic.runner import ClassicGamePlayers, ClassicGameRunner
from codenames.classic.state import ClassicOperativeState, ClassicSpymasterState
from codenames.classic.team import ClassicTeam
from codenames.generic.move import Clue, Guess
from codenames.generic.player import Operative, Spymaster
from codenames.generic.state import OperativeState, SpymasterState
from codenames.utils.vocabulary.languages import get_vocabulary

logging.basicConfig(level=logging.INFO, format="%(message)s", stream=sys.stdout)


####################################
# Naive CLI players implementation #
####################################


class CLISpymaster(Spymaster):
def give_clue(self, game_state: SpymasterState) -> Clue:
class CLISpymaster(ClassicSpymaster):
def give_clue(self, game_state: ClassicSpymasterState) -> Clue:
print("\nGive a hint. Board: \n" + game_state.board.printable_string)
print(f"Revealed cards: {list(game_state.board.revealed_card_indexes)}")
hint_word = input("Enter hint word: ")
card_amount = int(input("Enter card amount: "))
return Clue(word=hint_word, card_amount=card_amount)


class CLIOperative(Operative):
def guess(self, game_state: OperativeState) -> Guess:
class CLIOperative(ClassicOperative):
def guess(self, game_state: ClassicOperativeState) -> Guess:
print(f"\nGuess a card. Given clue: {game_state.current_clue}. Current board state: ")
print(game_state.board.printable_string)
card_word = input("Enter card word: ")
Expand Down Expand Up @@ -83,6 +80,7 @@ def run_classic_cli_game():


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format="%(message)s", stream=sys.stdout)
run_classic_cli_game()
```

Expand Down

0 comments on commit 9a0b85b

Please sign in to comment.