Watch algorithms come to life in your terminal
A beautiful, interactive CLI tool for visualizing sorting and pathfinding algorithms in real-time.
Built with Go and the Bubble Tea framework.
█████╗ ██╗ ██████╗ ██████╗ █████╗ ██████╗ ███████╗███╗ ██╗ █████╗
██╔══██╗██║ ██╔════╝ ██╔═══██╗ ██╔══██╗██╔══██╗██╔════╝████╗ ██║██╔══██╗
███████║██║ ██║ ███╗██║ ██║ ███████║██████╔╝█████╗ ██╔██╗ ██║███████║
██╔══██║██║ ██║ ██║██║ ██║ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██╔══██║
██║ ██║███████╗╚██████╔╝╚██████╔╝ ██║ ██║██║ ██║███████╗██║ ╚████║██║ ██║
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝
Watch data transform in real-time with beautiful bar visualizations:
| Algorithm | Time Complexity | Space Complexity | Description |
|---|---|---|---|
| Bubble Sort | O(n²) | O(1) | Repeatedly swaps adjacent elements |
| Selection Sort | O(n²) | O(1) | Finds minimum and places at beginning |
| Insertion Sort | O(n²) | O(1) | Builds sorted array one element at a time |
| Quick Sort | O(n log n) avg | O(log n) | Divide and conquer with pivot partitioning |
| Merge Sort | O(n log n) | O(n) | Recursive splitting and merging |
| Heap Sort | O(n log n) | O(1) | Uses binary heap data structure |
Navigate through randomly generated mazes:
| Algorithm | Time Complexity | Description |
|---|---|---|
| BFS | O(V + E) | Explores all neighbors at current depth first |
| DFS | O(V + E) | Explores as deep as possible before backtracking |
| Dijkstra | O((V + E) log V) | Finds shortest path by distance |
| A* | O(E log V) | Uses heuristic for optimal pathfinding |
# Clone the repository
git clone https://github.com/ethanwritescode/algo-arena.git
cd algo-arena
# Install dependencies
go mod tidy
# Build
go build -o algo-arena
# Run
./algo-arenago install github.com/ethanwritescode/algo-arena@latestLaunch the application:
./algo-arena| Key | Action |
|---|---|
↑ / ↓ or k / j |
Navigate menus |
Enter or Space |
Select option |
1 / 2 / 3 |
Set speed (Slow/Normal/Fast) |
Space or p |
Pause/Resume animation |
r |
Reset/Generate new data |
Esc |
Go back |
q |
Quit to menu / Exit |
- 🟦 Cyan - Unsorted elements
- 🟧 Orange - Elements being compared
- 🟪 Pink - Elements being swapped
- 🟨 Yellow - Pivot element (Quick Sort)
- 🟩 Green - Sorted elements
- S - Start position
- E - End/Goal position
- █ - Wall/Obstacle
- ○ - Visited cell
- ◆ - Current cell being explored
- ● - Final path
algo-arena/
├── main.go # Entry point
├── internal/
│ ├── algorithms/
│ │ ├── sorting/
│ │ │ └── sorting.go # Sorting algorithms & step generation
│ │ └── pathfinding/
│ │ └── pathfinding.go # Pathfinding algorithms & grid logic
│ └── tui/
│ ├── model.go # Bubble Tea model & update logic
│ └── styles.go # Lipgloss styles & theming
├── go.mod
└── README.md
This tool is perfect for:
- CS Students - Understand algorithm behavior visually
- Interview Prep - See how classic algorithms work
- Teaching - Demonstrate algorithms in class
- Self-Learning - Reinforce algorithmic concepts
Contributions are welcome! Here are some ideas:
- Add more sorting algorithms (Radix, Counting, Shell)
- Add more pathfinding algorithms (Greedy BFS, Jump Point Search)
- Add data structure visualizations (BST, Linked List, Hash Table)
- Add algorithm comparison mode
- Add step-by-step mode with explanations
- Export visualization as GIF
MIT License - feel free to use this project for learning and portfolio purposes!
- Charm - For the amazing Bubble Tea and Lip Gloss libraries
- The Go community for excellent tooling
Made with 💜 by Ethan James
⭐ Star this repo if you found it helpful!