Awesome
Cube Timer
A tui-based Rubik's cube timer written in Rust.
Instructions (pre-release)
git clone https://github.com/paarthmadan/cube && cd cube
cargo install --path .
cube
- Press <kbd>Space</kbd> to begin and end a solve
- Press <kbd>q</kbd> 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
- There are a few threads:
- 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