Crate libcoinche
source · [−]Expand description
Models a game of coinche (a french card game).
See coinched for an example of usage.
Here is a simple example:
extern crate libcoinche;
use libcoinche::{bid,cards,pos};
fn main() {
// The first player
let first = pos::PlayerPos::P0;
// Start the first phase with an auction
let mut auction = bid::Auction::new(first);
// Check their cards
let hands = auction.hands();
// Players bid or pass
auction.bid(pos::PlayerPos::P0, cards::Suit::Heart, bid::Target::Contract80).unwrap();
auction.pass(pos::PlayerPos::P1).unwrap();
auction.pass(pos::PlayerPos::P2).unwrap();
// The result is `Over` when the auction is ready to complete
match auction.pass(pos::PlayerPos::P3) {
Ok(bid::AuctionState::Over) => (),
_ => panic!("Should not happen"),
};
// Complete the auction to enter the second phase
let mut game = auction.complete().unwrap();
// Play some cards
game.play_card(pos::PlayerPos::P0, hands[0].get_card());
// ...
}
Modules
Auctions and bidding during the first phase of the game.
This module represents a basic, rule-agnostic 32-cards system.
Module for the card game, after auctions are complete.
Manage points and scores
Player position in the table
This module implements a trick in a game of coinche.
Functions
Quick method to get cards for 4 players.
Deal cards for 4 players deterministically.