Struct libcoinche::bid::Auction [] [src]

pub struct Auction {
    // some fields omitted
}

Represents the entire auction process.

Methods

impl Auction

fn new(first: PlayerPos) -> Self

Starts a new auction, starting with the player first.

fn get_state(&self) -> AuctionState

Returns the current state of the auctions.

fn next_player(&self) -> PlayerPos

Returns the player that is expected to play next.

fn bid(&mut self, pos: PlayerPos, trump: Suit, target: Target) -> Result<AuctionState, BidError>

Bid a new, higher contract.

fn current_contract(&self) -> Option<&Contract>

Look at the last offered contract.

Returns None if no contract was offered yet.

fn hands(&self) -> [Hand; 4]

Returns the players cards.

fn pass(&mut self, pos: PlayerPos) -> Result<AuctionState, BidError>

The current player passes his turn.

Returns the new auction state :

  • AuctionState::Cancelled if all players passed
  • AuctionState::Over if 3 players passed in a row
  • The previous state otherwise

fn coinche(&mut self, pos: PlayerPos) -> Result<AuctionState, BidError>

Attempt to coinche the current contract.

fn complete(&mut self) -> Result<GameState, BidError>

Consumes a complete auction to enter the second game phase.

If the auction was ready, returns Ok<GameState>