Skip to content

Tapas3341/N-Queens-Visualizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏰 N-Queens Visualizer

Welcome to the N-Queens Visualizer! This project demonstrates the backtracking algorithm used to solve the N-Queens problem in real-time. The visualizer is built using HTML, CSS, and JavaScript.

📝 Description

The N-Queens problem involves placing N queens on an N×N chessboard so that no two queens threaten each other. This visualizer shows how the backtracking algorithm solves this problem step-by-step.

How It Works

  1. Initialization: The visualizer sets up an N×N chessboard.
  2. Backtracking Algorithm: The core of the solution involves a recursive backtracking algorithm that attempts to place a queen in each row, ensuring that no two queens are in the same row, column, or diagonal.
  3. Real-Time Visualization: As the algorithm proceeds, the visualizer updates the board in real-time, showing each move and backtrack.
  4. Logs: Detailed logs display the moves and decisions made by the algorithm, helping users understand the process.

Algorithms Used

  • Recursion: The algorithm uses recursion to explore all possible placements of queens.
  • Backtracking: If placing a queen leads to a conflict, the algorithm backtracks and tries a different position.

✨ Features

  • 🎨 Visual representation of the N-Queens problem
  • ⏱️ Real-time visualization of the backtracking algorithm
  • 🎛️ Interactive controls to start and observe the backtracking algorithm
  • 📜 Logs displaying the moves played during the algorithm

Prerequisites

You need a web browser to run this project.

Installation

Open index.html in your preferred web browser, or visit the live version at (https://github.com/Tapas3341/N-Queens-Visualizer)

🎮 Controls

  • Start: Begins the visualization of the backtracking algorithm
  • Logs: Displays the moves played during the backtracking process

🤝 Contributing

Contributions are welcome! If you have suggestions for improvements or find any issues, please open an issue or submit a pull request.

Made with ❤️ by Tapasendra Patra

About

N-queens Visualizer using backtracking

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.6%
  • CSS 14.0%
  • HTML 9.4%