From 5fb96becbbc816a5ed98b055549f7245ab71d1da Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Fri, 15 May 2026 06:21:21 -0700 Subject: [PATCH] readme --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..145a42a --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +Card Game +========= + +`card_game` is a library to implement card games. Mainly interesting for the `Game` trait and the `Session` type. Contains klondike as the reference implementation. + +## Example + +```rust +use card_game::card_game::{Session, Game}; +use card_game::klondike::Klondike; + +// create game session +let game = Klondike::new(); +let mut session = Session::new(game); + +// is winnable +let is_winnable = session.is_winnable(); + +// play game +while let Some(instruction) = session.enumerate_instructions() { + session.process_instruction(instruction); +} + +// 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_winnable = {is_winnable}"); +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. +