Giter VIP home page Giter VIP logo

warnsdorff-algorithm-visualizer's Introduction

Warnsdorff's Algorithm

visualizer

Fig.1 Algorithm Visualization

Build

$ pip install -r requirements.txt

Intro

A knight's tour (See Fig.2) is a sequence of moves of a knight on a chessboard such that the knight visits every square only 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, otherwise it is open.

sample knight's tour

Fig.2 Sample Knight's Tour

We can solve the knight's tour problem using warnsdorff's algorithm, which states that:-

  • We can start from any initial position of the knight on the board.
  • We can always move to an adjacent, unvisited square with minimal degree(minimum number of unvisited adjacent).

Sample Run

Fig.1 demonstrates a sample run of the visualizer when knight is placed at 0, 0, you can find other samples here.

Symbol Meaning
0 Unvisited Cell
1 Visited Cell
2 Knight's Position

Fun Fact

On an 8 ร— 8 board, there are exactly 26,534,728,821,064 directed closed tours (i.e. two tours along the same path that travel in opposite directions are counted separately, as are rotations and reflections). The number of undirected closed tours is half this number, since every tour can be traced in reverse!

Facing a Issue

If you are in this situation first and foremost Don't panic ๐Ÿ˜ข I'm here to help you get over it. Simply click this and properly state your issue (be as verbose as you can be), After that sit tight and watch ๐ŸŽฅ the movie you have been postponing for so long while I ๐Ÿ‘ท fix the issue.

Want to Contribute

I will be glad ๐Ÿ˜ƒ to work with you on a new idea or fixing a invisible bug ๐Ÿ› or if you have already done the work ๐Ÿ”จ just create a pull request and I will merge it asap.

Well that's all for now but before you close this browser tab hit the star โญ button (it motivates me to make new stuff).

Have a great day ๐Ÿ˜Ž.

warnsdorff-algorithm-visualizer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rshrc zvtrung

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.