Crate scout_game

source ·

Structs

  • A card, this stores two values, however only the first is “active”. Implements flip(), a convenience method which simply flips the two values.
  • Stores information about the whole game. This implements game logic to process actions and check scores. It is also responsible for generating GameView objects from the perspective of the current player (self.turn)
  • View from perspective of single player. This is rotated, so vectors such as score may not align with the “true” indexes in GameState
  • Each player has a hand, score, and their “Scout show” move.

Enums

  • Player actions. These are Scout, Show and ScoutShow, which each take different parameters.
  • Result of taking an action on a GameView. This may end the game, resulting in Win or Loss.

Traits

  • Strategy trait implements get_action method to generates an Action based on a GameView. These can include user input, but are mostly computer players. Returning None will halt the current game.

Functions

  • Generate the default set hierarchy for the deck of 0-9 valued cards
  • Return all valid Actions for view. For a large hand this will include approximately:
  • Run a single game of Scout. The length of strategies determines the number of players, and the Strategy function each player uses.
  • Watch a single game of Scout. The length of strategies determines the number of players, and the Strategy function each player uses.

Type Aliases

  • To efficiently compare the value of sets, this hashmap is created.