player module¶
-
class
player.Player(name)[source]¶ Bases:
objectA human or computer Player in a UnoGame. This holds the basic details about a player and also some functions that the UnoGame object uses to interact with the Player.
- Parameters
name (str) – the name of the player
strategy (str) – “human” if the player is human or “computer” otherwise
-
get_valid_card_choices_from_hand(top_card)[source]¶ Check to see if the card is playable given the top card
- Parameters
top_card (Card) – Card at the top of the deck
- Returns
(bool) for whether the card is playable
-
class
player.HumanPlayer(name)[source]¶ Bases:
player.PlayerHummanPlayer extends the Player class. A HumanPlayer can do everything a Player can do and more: HumanPlayer gets input about choices from a user.
-
class
player.ComputerPlayer(name)[source]¶ Bases:
player.PlayerComputerPlayer extends the ComputerPlayer class. AComputerPlayer can do everything a Player can do and more: ComputerPlayer uses a basic (read: bad) strategy to make choices during a game.
-
class
player.RandomComputerPlayer(name)[source]¶ Bases:
player.ComputerPlayerRandomComputerPlayer extends the ComputerPlayer class. The RandomComputerPlayer overrides the ComputerPlayer choice functions to randomly choose a color or valid card (a much better, but still bad strategy).
-
class
player.StudentComputerPlayer(name)[source]¶ Bases:
player.ComputerPlayerStudentComputerPlayer extends the ComputerPlayer class. Can you get your computer player to consistently win more than 30% of games?