Coders Packet

N Queen Backtracking game in C++

By Pranav Singh

A simple game using the N Queen Backtracking Algorithm in C++ to explain the working of an algorithm and file handling.

This project aims at the explanation of the N Queen backtracking algorithm and file handling. When the game is run, it shows three options that are playing the game, see all the scores and quitting to exit the game. 

When Play the game option is selected, a screen appears which asks the user's name and then another screen shows the rules for the game and waits for 3 seconds so that user can read the rules and then the game starts. It asks you the question that whether n queens can be placed on an NXN chessboard so that no two queens attack each other. The user has to answer yes or no using the 1 and 2 keys. The game asks for 5 questions and rewards accordingly. In the end, it shows the total points scored. The user name and its score are stored in a file using file handling methods.

When the See scores option is selected, file handling comes into action again and all the past user's names and scores are retrieved from the file and then displayed to the user.

Download Complete Code


No comments yet