# â¨ī¸ Code Typing
[](https://crates.io/crates/code-typing)
[](https://opensource.org/licenses/MIT)
**A terminal-based typing game for Rust programmers.** Practice typing real Rust code snippets to build muscle memory for Rust syntax and special characters.
<p align="center">
<img src="demo.gif" alt="Code Typing Demo" width="600">
</p>
<p align="center">
<img src="game_play_screen.png" alt="Code Typing Screenshot" width="600">
</p>
## đ¤ Why Code Typing?
Traditional typing tests use regular English text, but Rust programming requires typing special characters like `{}`, `=>`, `::`, `|x|`, `<T>`, and `&mut`. **Code Typing** bridges this gap:
- đĻ **Rust-focused** â 100 curated Rust code snippets
- đ¯ **Real patterns** â algorithms, data structures, traits, iterators, and more
- ⥠**Real-time feedback** â see correct/incorrect characters instantly
- đ **WPM & accuracy tracking** â measure your improvement over time
- đ¤ **Output preview** â see the expected output after completing code with `println!`
## đ Installation
### From crates.io
```bash
cargo install code-typing
```
### From source
```bash
git clone https://github.com/wooyukit/code-typing
cd code-typing
cargo install --path .
```
## đŦ Usage
```bash
code-typing
```
That's it! Start typing the code you see on screen. The timer starts on your first keystroke. âąī¸
## đŽ Gameplay
| đ¨ Syntax-highlighted text | Correctly typed characters |
| đ´ Red underlined text | Incorrect characters |
| đĄ Yellow cursor | Current position |
| đ Progress bar | Shows completion percentage |
When you complete a snippet:
- đ¤ **Output panel** appears showing the expected `println!` output (if any)
- đī¸ **Performance rating** based on WPM and accuracy: đ LEGENDARY, â EXCELLENT, â GOOD, or â COMPLETE
- â Press **Enter** for a new snippet or **Esc** to quit
## â¨ī¸ Controls
| `â` `â` | đ Change code sample (before typing starts) |
| `Tab` | âĄī¸ Insert 4-space indentation |
| `Enter` | âŠī¸ Auto-indent newline (during typing) / Next snippet (after completing) |
| `Backspace` | âŦ
ī¸ Delete last character |
| `Esc` | đ Restart current sample (during typing) / đĒ Quit (before typing or after completing) |
## đ Code Samples Include
- **Algorithms** â QuickSort, Binary Search, Merge Sort, DFS, BFS, Dijkstra
- **Data Structures** â Linked List, Binary Tree, Stack, Queue, HashMap, BTreeMap, VecDeque
- **Classic Problems** â FizzBuzz, Two Sum, Valid Parentheses, Fibonacci
- **Rust Patterns** â Iterators, Closures, Traits, Generics, Error Handling
- **Smart Pointers** â Box, Rc, RefCell, Arc, Cow, PhantomData
- **Traits** â From/Into, Drop, Deref, AsRef, Default, Display, PartialEq/Ord, Hash, Index
- **Concurrency** â Mutex, RwLock, Channels, Threads, Arc
- **Design Patterns** â Builder, Newtype, Type State
- **Advanced Iterators** â fold, reduce, partition, peekable, flatten, flat_map
## đ Requirements
- Rust 1.70+ (for installation)
- Terminal with Unicode support
- Works on macOS, Linux, and Windows
## đĄ Tips for Improving
1. đ¯ **Focus on accuracy first** â Speed comes naturally with muscle memory
2. ⥠**Pay attention to special characters** â `{}`, `()`, `<>`, `::`, `=>` are common in code
3. đ **Practice indentation** â Use Tab for consistent spacing
4. â **Take breaks** â Short, focused sessions are more effective
## đ¤ Contributing
Contributions welcome! Feel free to:
- Add more code samples
- Support other programming languages
- Improve the UI/UX
- Report bugs
## đ License
MIT Š Vincent Woo