update readme and add action
Some checks failed
CI / Build and test (ubuntu-latest) (push) Successful in 50s
CI / Build and test (ubuntu-latest) (pull_request) Successful in 40s
CI / Build and test (Windows) (pull_request) Failing after 4s
CI / Build and test (Windows) (push) Failing after 8s

This commit is contained in:
2025-11-10 22:15:47 +01:00
parent 29b34fa3f0
commit c8deb6f0e8
6 changed files with 136 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ Logic and rules for the German card game Schafkopf. This crate provides types
and helpers for deck construction, common game modes and basic trick-taking
logic.
**Crate:** `schafkopf-logic`**Version:** 0.1.0
**Crate:** [`schafkopf-logic`](https://crates.io/crates/schafkopf-logic)
## Features
@@ -36,13 +36,13 @@ fn main() {
deck.shuffle();
let hands = deck.deal_4x8().expect("deck should contain 32 cards");
// form a sample trick from the first card of each hand
// Form a sample trick from the first card of each hand and print it
let trick = [&hands[0][0], &hands[1][0], &hands[2][0], &hands[3][0]];
let winner = Gamemode::Sauspiel(Suit::Herz).winning_card(trick);
println!("Winning card: {}", winner);
println!("Trick: {}, {}, {}, {}", trick[0], trick[1], trick[2], trick[3]);
// rank points example
assert_eq!(Rank::Ass.points(), 11);
// Determine the winner for a sample game mode (Sauspiel with Schell)
let winner = Gamemode::Sauspiel(Suit::Schell).winning_card(trick);
println!("Winning card: {}", winner);
}
```