Skip to content

paul7aa/KnightsTour

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Knight's Tour

Contents Description

Application created in C# using WPF framework and MVVM architectural pattern to illustrate The Knight's Tour Problem

Explanation

A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed (or re-entrant); otherwise, it is open. GIF showing the Knight's Tour example on a 8x8 board:

Tours_Count

Warnsdorff's Rule

Warnsdorff's rule is a heuristic for finding a single knight's tour. The knight is moved so that it always proceeds to the square from which the knight will have the fewest onward moves. When calculating the number of onward moves for each candidate square, we do not count moves that revisit any square already visited. It is possible to have two or more choices for which the number of onward moves is equal In the following image, the knight will select the cell with least possibilities (the cell containing 2).

Warnsdorffs Rule

MVVM Structure

Model–view–viewmodel (MVVM) is a software architectural pattern that facilitates the separation of the development of the graphical user interface (the view) – be it via a markup language or GUI code – from the development of the business logic or back-end logic (the model) so that the view is not dependent on any specific model platform. The viewmodel of MVVM is a value converter, meaning the viewmodel is responsible for exposing (converting) the data objects from the model in such a way that objects are easily managed and presented. In this respect, the viewmodel is more model than view, and handles most if not all of the view's display logic.[1] The viewmodel may implement a mediator pattern, organizing access to the back-end logic around the set of use cases supported by the view.

MVVM_Structure

Source: https://en.wikipedia.org/wiki/Model–view–viewmodel

Algorithm code

Algorithm1 Algorithm2 Algorithm3 Algorithm4

Screenshots

Screenshot 1

Screenshot 2

Start Tour GIF

About

Application created to illustrate The Knight's Tour Problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages