#cli #cargo #klondike #solitaire

bin+lib klondike-rs

CLI Klondike Solitaire written in Rust

7 releases (4 stable)

✓ Uses Rust 2018 edition

1.1.0 Nov 10, 2019
1.0.2 Nov 10, 2019
0.3.0 Apr 28, 2019
0.2.0 Apr 27, 2019
0.1.0 Feb 8, 2019

#4 in Games

Download history 4/week @ 2019-07-28 11/week @ 2019-08-04 3/week @ 2019-08-11 1/week @ 2019-08-18 32/week @ 2019-08-25 16/week @ 2019-09-01 2/week @ 2019-09-08 23/week @ 2019-09-15 15/week @ 2019-09-22 6/week @ 2019-09-29 5/week @ 2019-10-06 9/week @ 2019-10-13 4/week @ 2019-10-20 13/week @ 2019-10-27 14/week @ 2019-11-03

51 downloads per month

MIT license

135KB
3.5K SLoC

klondike-rs

Crates.io CircleCI

CLI Klondike Solitaire written in Rust

Default State Gameplay

Installing from Crates.io

The simplest way to run klondike-rs is to install it from crates.io using Cargo.

$ cargo install klondike-rs

Cargo will have to download and compile all necessary dependencies, as well as compile this project's source, so it may take a few moments.

Then, assuming Cargo is set up on your path, you can run it using

$ klondike-rs

If you don't have Rust (or Cargo, its build tool), you can get it using Rustup. I will try to keep the project compiling on stable Rust, but I reserve the right to require nightly if there's a really nice feature I want. :)

Compiling from Source

Technically installing from crates.io is compiling from source, but if you would like to check out the code and mess around with it, you can do so using

$ git clone https://github.com/chrisbouchard/klondike-rs.git
...

$ cd klondike-rs
$ cargo run  

To find out more about Cargo, you can check out The Cargo Book.

Controls

You can always type h or ? to get the help screen!

To be written…

Configuration

Configuration uses TOML, a popular mark-up language among Rust projects. Below is a sample configuration file which sets all settings to their default values, so you'd only need to include a key if you wanted to change its value.

[display]

# Whether to use ANSI color escapes
# TODO: Currently ignored
color = true

# Whether to use Unicode box-drawing characters
# TODO: Currently ignored
unicode = true


[game]

# How many cards to draw (usually 3 or 1)
# TODO: No bounds checking, so don't break things
draw_from_stock_len = 3

# Whether it's permitted to move a card out of a foundation
take_from_foundation = true

Configuration files are picked up from several locations, depending on your OS.

  • $HOME/.klondike-rs.tomlAny OS
    • E.g., /home/chris/.klondkie-rs.toml
  • $XDG_CONFIG_HOME/klondike-rs/config.tomlLinux only
    • E.g., /home/chris/.config/klondkie-rs/config.toml
  • $HOME/Library/Preferences/net.upliftinglemma.klondike-rs/config.tomlMacOS only
    • E.g., /Users/Chris/Library/Preferences/net.upliftinglemma.klondike-rs/config.toml
  • {FOLDERID_RoamingAppData}\upliftinglemma\klondike-rs\config\config.tomlWindows only
    • E.g., C:\Users\Chris\AppData\Roaming\upliftinglemma\klondike-rs\config\config.toml

TODO:

This project is still very alpha, but it's at least runnable. Some high-level things that still need to happen:

  • Respect configuration regarding color and Unicode.
  • Document all public structs and functions and re-enable warn(missing_docs).
  • Offer more cosmetic configuration, e.g., card backs.

Contributing

To be written…

Dependencies

~6MB
~134K SLoC