/KnightTour

GUI Knight's Tour solution in Java

Primary LanguageJava

Knight's Tour Project

Introduction

The Knight’s Tour problem is a classic problem in graph theory. Pondered by legendary Mathematicians like Leonhard Euler, this problem existed first 1000 years ago and was solved in 1823 A.D. It is played on a chessboard. The process of solving utilizes a single chess piece — the knight. The knight piece should visit every square of the board exactly once; with respect to its designated movement: L-pattern.

This project served as an output for my final requirement in CC 12 - Computer Programming II. It utilizes the Java Foundational Classes and other Java libraries to implement a GUI version of the Warnsdorff's Algorithm: an algorithm that solves the infamous Knight's Tour Problem.

Warnsdorff's Algorithm provides a closed-type of solution to the Knight's Tour. This definition means that the last location (64th Jump of the Knight Piece) leads to the 1st position with the Knight Piece's movement pattern.

This project's code for Warnsdorff's Algorithm is from GeeksForGeeks.org and the Knight Piece icon is from Chess icons created by Good Ware - Flaticon: full disclosure to tell the world that no one's stealing resources here ☺. With this said, the GUI implementation as well as some tweaking of the algorithm are from this repository's owner. The entire design, the colors, and the concept of implementation is of Adriane Troy V. Roa.

Features

  1. User privilege to choose first cell of Knight
  2. Numbers embedded in cells after each jump
  3. Knight Piece icon to depict realistic Knight Piece jumps
  4. Buttons in GridLayout with configurated colors to complement the Knight Piece icon
  5. Use of Warnsdorff's Algorithm to provide a closed-type Knight's Tour solution

Screenshot

Screenshot of the solution in action

Useful Links for Further Explanation