Skip to content

randy-riegsecker/EightQueens

Repository files navigation

Eight Queens Puzzle Game

ic_launcher_round The Eight Queens Puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. In other words, the solution requires that no two queens share the same row, column, or diagonal. There are 92 different solutions.

The problem was first posed in the mid-19th century. In the modern era, it is often used as an example problem for computer programming. While there are many programs on the Internet that solve the problem algorithmically and recursively, there are very few puzzle games for you to actually try it yourself.

Playing the Game

You start by adding and removing queens on the chessboard to solve the puzzle. To place or remove a queen from a square, click on that square. You can only have up to eight queens on the board at any given time, and the counter shows you how many are placed.

While playing, the chessboard squares turn red if you've placed queens in a threatening position with another queen (they share the same column, row, or diagonal). This provides a hint that you need to change the position of at least one queen.

If you want to clear the chessboard, use the RESET BOARD button.

Winning the Game

To win the game, you need to figure out how to place the eight queens on the chess board. When you've found a solution to the puzzle, the squares with the eight correctly placed queens turn green and the game ends! RESET BOARD clears the board for a new game.

Technical Details

The code is written in Java and the application was developed using Android Studio. The application demonstrates the use of Canvas and Paint classes for drawing on the screen, along with creating the chessboard as a custom element.

Thanks to https://www.youtube.com/@PracticalCoding for a thorough YouTube Tic-Tac-Toe game tutorial that provided the guidance to complete this project.

I'd love to hear from you! Happy Gaming!

Randy Riegsecker

Title Screen

Eight Queens Title Screen

Game Screen

Eight Queens Game Screen