Skip to content

epsil0n0/knight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Knight Short and Minimum step Path Solver


Given a chess board, find the shortest distance (minimum number of steps) and path taken by a Knight to reach given destination from given source.

The idea is to use BFS algorithm to solve this problem.


Requirements tools:
docker
docker-compose


How to run project:

git clone https://github.com/epsil0n0/knight.git

cd knight

docker-compose up -d



How To send request:

request to "/" api in POST method:

Hint:
n: number of N*N ChessBoard size
start_x,start_y: start location on the chessboard
end_x,end_y: target location on the chessboard  

curl --location --request POST 'localhost' \
--header 'Content-Type: application/json' \
--data-raw '{"n":8,
 "start_x":0,
 "start_y": 7,
 "end_x": 7,
 "end_y": 0
}'



output:

{"Minimum number of steps required is": 6, "The complete path is:": [[0, 7], [2, 6], [4, 5], [6, 4], [4, 3], [6, 2], [7, 0]]}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published