Skip to content

AlaaMousa05/Knight-Tour-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Knight Tour Solver

Description

A Python project that solves the Knight's Tour Problem using search algorithms.

The program extracts the first six unique letters from a user's name and places them on an 8x8 board, then searches for a valid solution where a chess knight can visit all letters following standard knight movement rules.

Algorithms Used

  • BFS (Breadth-First Search) - explores all nodes at the current depth level
  • DFS (Depth-First Search) - explores as far as possible along each branch

Features

  • Extracts unique letters from user's name
  • Places letters at predefined positions on the board
  • Finds valid solutions using two different search algorithms
  • Displays the number of states expanded during search
  • Interactive interface to select starting letter
  • Visual board representation with formatted output

Usage

python index.py

Example

Student Name: Alaa Mousa
First six unique letters: A L M O U S

Enter starting letter: A
--- BFS Solution ---
One of the goal states:
[Board display]

Solution:
[Move instructions]

Number of states expanded: [count]

How It Works

  1. Extract up to 6 unique letters from the student's name
  2. Place them at fixed positions on the board
  3. Use BFS or DFS to find a knight's path visiting all letters
  4. Display the goal state and the sequence of moves

Requirements

  • Python 3.x

Author

Alaa Mousa

About

A Python project that solves the Knight's Tour Problem using search algorithms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages