Quaternions
  • Joined on 2026-04-18

klondike (0.3.0)

Published 2026-05-29 21:54:23 +00:00 by Quaternions

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+https://git.aleshym.co/api/packages/Quaternions/cargo/" # Sparse index
# index = "https://git.aleshym.co/Quaternions/_cargo-index.git" # Git

[net]
git-fetch-with-cli = true
cargo add klondike@0.3.0

About this package

Klondike

klondike is a pure-logic implementation of Klondike using card_game. Graphics not included.

Example

use card_game::Session;
use klondike::{Klondike, KlondikeConfig};

// create game session
let game = Klondike::with_seed(123);
let config = KlondikeConfig::default();
let mut session = Session::new_default(game);

// play game a bit
while let Some(instruction) = session.state().state().get_auto_move(&config) {
	session.process_instruction(instruction);

	// quit after 200 moves or win
	if session.is_win() || 200 < session.stats().stats().moves() {
		break;
	}
}

// did win
let is_win = session.is_win();

// print session history
for (i, instruction) in session.history().iter().enumerate() {
	println!("move {i} = {instruction:?}");
}

println!("is_win = {is_win}");

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

ID Version
card_game ^0.4.0
rand ^0.10.1
Details
Cargo
2026-05-29 21:54:23 +00:00
4
11 KiB
Assets (1)
Versions (4) View all
0.4.0 2026-06-09
0.3.0 2026-05-29
0.2.0 2026-05-29
0.1.0 2026-05-18