Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algo Arena

Go Terminal Bubble Tea License

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.


   █████╗ ██╗      ██████╗  ██████╗      █████╗ ██████╗ ███████╗███╗   ██╗ █████╗ 
  ██╔══██╗██║     ██╔════╝ ██╔═══██╗    ██╔══██╗██╔══██╗██╔════╝████╗  ██║██╔══██╗
  ███████║██║     ██║  ███╗██║   ██║    ███████║██████╔╝█████╗  ██╔██╗ ██║███████║
  ██╔══██║██║     ██║   ██║██║   ██║    ██╔══██║██╔══██╗██╔══╝  ██║╚██╗██║██╔══██║
  ██║  ██║███████╗╚██████╔╝╚██████╔╝    ██║  ██║██║  ██║███████╗██║ ╚████║██║  ██║
  ╚═╝  ╚═╝╚══════╝ ╚═════╝  ╚═════╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝

Features

Sorting Algorithms

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

Pathfinding Algorithms

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

Installation

From Source

# 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-arena

Using Go Install

go install github.com/ethanwritescode/algo-arena@latest

Usage

Launch the application:

./algo-arena

Controls

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

Visual Legend

Sorting Visualization

  • 🟦 Cyan - Unsorted elements
  • 🟧 Orange - Elements being compared
  • 🟪 Pink - Elements being swapped
  • 🟨 Yellow - Pivot element (Quick Sort)
  • 🟩 Green - Sorted elements

Pathfinding Visualization

  • S - Start position
  • E - End/Goal position
  • █ - Wall/Obstacle
  • ○ - Visited cell
  • ◆ - Current cell being explored
  • ● - Final path

Architecture

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

Educational Value

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

Contributing

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

License

MIT License - feel free to use this project for learning and portfolio purposes!

Acknowledgments

  • 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!

About

Interactive CLI tool for visualizing sorting and pathfinding algorithms in real-time.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages