Skip to content

This repository contains my solution of the Knight Puzzle—a challenging puzzle in which eight knights are placed on a 3x3 chessboard with one empty square. The goal is to rearrange the knights into a specific ordered configuration by making valid knight moves while following the rules of chess.

Notifications You must be signed in to change notification settings

allamed/Knight-Puzzle-Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Knight-Puzzle-Solution

6443d99f7a4eb1a3d448704d8ff5b3ac

Puzzle Description

In the Knight Puzzle:

The chessboard has the following structure:

. x . x .
x . . . x
. . o . .
x . . . x
. x . x .

x: Represents squares where knights are initially placed.

o: Represents the empty square.

Knights cannot attack each other, occupy the same square, or leave the board.

The objective is to reach the following ordered configuration:

1 2 3
4 5 6
7 8 .

How the Solver Works

The JavaScript code in this repository employs a depth-first search algorithm to find the minimum number of valid moves required to achieve the goal configuration. It also checks for unreachable states and handles various edge cases to provide accurate solutions.

About

This repository contains my solution of the Knight Puzzle—a challenging puzzle in which eight knights are placed on a 3x3 chessboard with one empty square. The goal is to rearrange the knights into a specific ordered configuration by making valid knight moves while following the rules of chess.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published