Files
card_game/klondike
2026-05-18 15:51:17 -07:00
..
2026-05-18 13:43:39 -07:00
2026-05-18 15:43:32 -07:00
2026-05-18 12:44:12 -07:00
2026-05-18 12:44:12 -07:00
2026-05-18 15:51:17 -07:00

Klondike

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

Example

use card_game::Session;
use klondike::Klondike;

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

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

	// quit after 1000 moves
	if 1000 < 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.