subject

Your program should read from an input file, which will contain one or more test cases. Each test case consists of one line containing two squares separated by one space. A square is a string consisting of a letter (a-h) representing the column and a digit (1-8) representing the row on the chessboard. Input. txte2 e4a1 b2b2 c3a1 h8a1 h7h8 a1b1 c3f6 f6Output SpecificationFor each test case, print one line saying To get from xx to yy takes ?? knight moves. in console. Sample OutputBelow is the correct output for the previous sample input:To get from e2 to e4 takes 2 knight moves. To get from a1 to b2 takes 4 knight moves. To get from b2 to c3 takes 2 knight moves. To get from a1 to h8 takes 6 knight moves. To get from a1 to h7 takes 5 knight moves. To get from h8 to a1 takes 6 knight moves. To get from b1 to c3 takes 1 knight moves. To get from f6 to f6 takes 0 knight moves. Hints1. According to the problem description, the grid is 8 by 8, therefore there are 64 squares. We can then model the chessboard as a graph with 64 vertices; and an edge between two vertices exists if and only if we can make a knight move from one vertex to another.2. When moving to the next position, a knight can have at most eight possible directions, as shown in the above figure for the black knight, without getting out of the chess board boundary.3. The problem becomes a graph traversal problem!4. DFS or BFS? Which one will work?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:30
Write a program that inserts the digits of an integer into an array in originalorderfollowed by reverse order. first, promptthe user to enter a positive integer(> 0). determine the number of digits of the integer. create a dynamically allocated integer arrayof a size twice the number of digits.now insert the digits in original order which will occupy half of the array. then, insert the digits in reverse order.finally, output thedigits in thearray.use at least two functions to organize your program.
Answers: 3
question
Computers and Technology, 23.06.2019 20:40
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
question
Computers and Technology, 24.06.2019 21:00
Which device has the most limited computing functionality?
Answers: 1
question
Computers and Technology, 25.06.2019 06:00
Sam needs to create a spreadsheet for his coworkers. they will need to follow a crossed a long road of data. sam would like to make his spreadsheet easy to read. sam should
Answers: 1
You know the right answer?
Your program should read from an input file, which will contain one or more test cases. Each test ca...
Questions
question
Mathematics, 01.12.2020 04:20
question
Mathematics, 01.12.2020 04:20
question
History, 01.12.2020 04:20
question
Biology, 01.12.2020 04:20
Questions on the website: 13722363