Giter Site home page Giter Site logo

cube's Introduction

Cube Timer

A tui-based Rubik's cube timer written in Rust.

Cube demo

Cube demo in larger TMUX session

Instructions (pre-release)

git clone https://github.com/paarthmadan/cube && cd cube
cargo install --path .
cube
  1. Press Space to begin and end a solve
  2. Press q to exit the process

Still heavily in development โ€“ proper build and release instructions will be added shortly.

Feature List

  • Timer
  • Basic TUI
  • Scramble generator
  • Statistics
  • Solve graph
  • Persisting data across sessions (data written to ~/.cube/data.json)

Not yet implemented

  • Minimizing CPU usage
  • Toggling between different cube sessions
  • Custom configuration (colours etc.)
  • Optimizing UI for different frame sizes (right now it's ideally used in a small tmux pane off to the side :/)

How does it work?

  • Built on top of the tui-rs crate.
  • The process itself is really a glorified timer:
    • There are a few threads:
      • Keyboard Input
      • Redraw Interrupt Dispatcher
  • Communication between threads uses basic message passing โ€“ Rust has a nice paradigm for this called mpsc.
  • The main thread performs blocked-waiting for interrupts (events) spawned by other threads. Starvation isn't an issue because the redraw interrupt is dispatched at a fixed interval.
  • The tick rate for the process is currently set to 50, which would mean the process exhibits roughly 20FPS, which is sufficient.

Motivation

  • Practicing Rust
  • Applying some of the fundamentals learned from Operating Systems
  • Now I don't have to open my browser everytime I feel like cubing

cube's People

Contributors

paarthmadan 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

Watchers

 avatar  avatar

Forkers

sampai20

cube's Issues

Persisting data across sessions

Essential feature to make this usable. Persist data across sessions, I'm thinking it'd be something along the lines of:

On exit:

  1. Serialize session data into JSON or some similar file type (https://github.com/serde-rs/json, https://github.com/serde-rs)
  2. Persist serialized data on disk

On entry:

  1. Read from disk (if exists), deserialize, and populate process data
  2. Write to local process data

Schema:

Ex:

{
    "times": [
      1.23,
      2.34,
    ],
}

We can write the file to ~/.cube/data.json

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.