Skip to content

ThulaniImansa/AlgorithmVisualizer

Repository files navigation

AlgorithmVisualizer

CSCI 22042- Visual Programming Individual Assignment

Algorithm Visualizer (Sorting & Pathfinding)

Student Name: [Your Full Name]
Registration Number: [Your Registration Number]
Course Code: CSCI 22042
University: University of Kelaniya
Academic Year: 2024/2025 – Semester II


📌 Project Overview

This project is a C# Windows Forms desktop application that visually demonstrates how sorting and pathfinding algorithms work step-by-step.

It provides interactive visualizations using GDI+ graphics and Timer-based animation, allowing users to observe how algorithms process data in real time.

The system is designed as a multi-form application with modular structure and proper separation of concerns using OOP principles.


🎯 Key Features


🔷 Sorting Visualizer

The Sorting Visualizer allows users to observe sorting algorithms through animated bar charts.

Features:

  • Visual representation using bar graphs (Panel + GDI+)
  • Implements 2 sorting algorithms:
    • Quick Sort
    • Insertion Sort
  • Step-by-step animation:
    • Comparisons
    • Swaps / Merges
  • Color-coded states:
    • Default
    • Comparing
    • Swapping
    • Sorted
  • Live comparison counter
  • Generate random array
  • Configurable:
    • Array size
    • Animation speed
  • Start and Reset controls with proper state handling

🟩 Pathfinding Visualizer

The Pathfinding Visualizer demonstrates how BFS explores a grid to find the shortest path.

Features:

  • Interactive grid system (Panel + GDI+)
  • Implements Breadth-First Search (BFS)
  • User interaction:
    • Set Start node
    • Set End node
    • Draw wall obstacles
  • Step-by-step animation of node exploration
  • Final shortest path visualization
  • Color-coded tiles:
    • Unvisited
    • Wall
    • Start
    • End
    • Visited
    • Final Path
  • Error handling for invalid input (missing start/end)
  • Configurable grid size and animation speed

⚙ Settings Form

A modal settings form used to configure both visualizers.

Features:

  • Adjust array size (Sorting Visualizer)
  • Adjust grid size (Pathfinding Visualizer)
  • Adjust animation speed
  • Values are passed dynamically to active forms

🧱 Application Structure

The application consists of 4 main forms:

  • MainForm → Navigation screen
  • SortingVisualizerForm → Sorting animations
  • PathfindingVisualizerForm → Pathfinding animations
  • SettingsForm → Configuration panel (modal dialog)

🛠 Technical Implementation

  • Language: C#
  • Framework: .NET Windows Forms
  • IDE: Visual Studio
  • Graphics: System.Drawing (GDI+)
  • Animation: System.Windows.Forms.Timer

Constraints Followed:

  • All algorithms implemented from scratch
  • No use of built-in sorting methods (Array.Sort, List.Sort)
  • No third-party visualization libraries
  • Each algorithm implemented in separate classes (OOP design)
  • Timer-based animation (no blocking UI threads)
  • Proper validation and error handling
  • Clean form lifecycle management

📂 Project Structure

AlgorithmVisualizer/
│
├── Forms/
│   ├── MainForm.cs          # Entry point form, navigate to visualizers
│   ├── SortingForm.cs       # Sorting algorithm visualizer UI
│   ├── PathfindingForm.cs   # Pathfinding algorithm visualizer UI
│   └── SettingsForm.cs      # Settings for speed and grid size
│
├── Algorithms/
│   ├── Sorting/
│   │   ├── QuickSort.cs     # Quick sort implementation
│   │   └── InsertionSort.cs # Insertion sort implementation
│   │
│   └── Pathfinding/
│       └── BFS.cs           # Breadth-First Search implementation
│
├── Models/
│   └── Node.cs              # Grid node model for pathfinding
│
└── Program.cs               # Application entry point

🚀 How to Run the Project

  1. Clone or download the repository
  2. Open the .sln file using Visual Studio
  3. Restore dependencies if required
  4. Build the solution
  5. Run the application (Start Debugging)

🎥 Demo Video

👉 Video Link: [Insert Your Demo Video Link Here]

The demo includes:

  • Sorting visualizer (Quick Sort + Insertion Sort)
  • Pathfinding visualizer (BFS)
  • Settings form configuration
  • Full animation demonstrations
  • Grid interaction (walls, start, end)

🔀 GitHub Workflow

  • Feature-based branching used (feature/sorting, feature/pathfinding, etc.)
  • Main branch always kept stable
  • Pull Requests used for merging features
  • Meaningful and descriptive commit messages used throughout development
  • No direct commits to main after initial setup

⚠ Academic Integrity

This project is developed as an individual submission for CSCI 22042.

  • All code is written independently
  • Algorithms are implemented manually without external copying
  • Any references used for learning are acknowledged in comments or documentation
  • No direct copying from GitHub or other students

Violation of academic integrity rules is strictly avoided.


📧 Contact

Lecturer-in-Charge (LIC): @haturusinghe
Email: shatur251@kln.ac.lk


About

CSCI 22042- Visual Programming Individual Assignment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages