Bishalsarang / N-Queens-Visualisation

Simple Visualisation of NQueens using C++ and OpenGL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository contains the visualiazation of popular algorithmic problems : N-Queens using backtracking.

Problem Description

The n-queens puzzle is the problem of placing n queens on an n_×_n chessboard such that no two queens attack each other.

Given an integer n, visualise all distinct solutions using backtracking to the n-queens puzzle.

TODO:

  • Draw board and queens,
  • Implement backtracking algo,
  • Mark attacking positions,
  • Add command line functionality to control number of queens, animation speed,
  • Code Refactoring
  • Build standalone executable.

Tools and Language Used

  1. C++
  2. OpenGL

Instructions

1. Running the project file

  • Setup Codeblocks for OpenGL and Glut.
  • Open nqueens.cbp.
  • Build and run the project.

2. Running executable


The program generates all the solutions to N queens problem with visualisation.

Screenshots:

  • N = 4 Nqueens 4 The total solutions for N = 4 queen is 2 _ Sol 1| SOl2|
  • N = 5 enter image description here