8Queens Problem

  • Category: School Project
  • Class: Introduction to AI
  • Project date: Sept 24th, 2021
  • Project URL: Github

Solving a chess puzzle using Hill-Climbing

The goal of the 8 queens problem is to move 8 queens on a chess board so that none of the queens are able to take another queen in one move. With this project, this puzzle was solved using Hill-Climbing with random restart. The queens are first put into seperate columns. Then, every neighbor state is generated and put into an array. The program then calculates the heuristic value for every neighbor (The number of conflicts on the board) and selects the move with the lowest heuristic value. This continues until there are no better moves left. The number of conflicts is then checked. If there are none, a solution has been found. If there is still conflicts remaining, then the local minima has been reached and a restart is performed.