Giter Club home page Giter Club logo

klondike-rs's Introduction

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…

klondike-rs's People

Contributors

chrisbouchard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

klondike-rs's Issues

nightly

Maybe worth mentioning that you need nightly:

cargo +nightly run --release

Otherwise you get:

cargo run --release
...
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> src/lib.rs:13:1
   |
13 | #![feature(const_fn)]
   | ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: Could not compile `klondike-rs`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Extract the Coords from Widgets

Widgets should just be in charge of knowing their size and drawing themselves. We can then create a new type that would wrap a widget and have a position.

Possibly this type would store a Coord internally, but its interface should (also?) allow Positions to be specified for horizontal and vertical alignment.

enum Position {
    FlushStart,
    FlushEnd,
    FromStart(usize),
    FromEnd(usize),
    Middle,
}

Extract the base functionality of Areas

Currently each area implements the Area trait fully and independently. We should extract the "essence" of each area into one or more sub-traits which could be slotted into a new BaseArea<...> type, which would itself implement Area.

Detect when the player wins

When the player wins the game, we should

  1. Congratulate them.
  2. Give them the option to quit or start a new game.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.