The purpose is to write a program with 2D arrays that will display Knight's Tour. Knight's Tour is a fascinating problem that is done on an electronic chessboard with a knight. Starting at any location on the chessboard, a knight proceeds to move on the board in such a manner that all positions on the chessboard are visited, once and once only. The knight may only move according to the rules of chess playing. The matrixes below show a sequence of knight moves that starts from the top-left corner. In most cases, the knight is locked in place and can go no farther. Note: there are only 3 legal knight moves from the 44 locations and they have already been visited. 01 60 39 34 31 18 09 64 38 35 32 61 10 63 30 17 59 02 37 40 33 28 19 08 36 49 42 27 62 11 16 29 43 58 03 50 41 24 07 20 48 51 46 55 26 21 12 15 57 44 53 04 23 14 25 06 52 47 56 45 54 05 22 13 01 22 39 20 03 18 09 16 00 37 02 23 08 15 04 13 35 40 21 38 19 12 17 10 00 00 36 41 24 07 14 05 00 34 00 32 00 28 11 26 00 00 00 00 42 25 06 29 00 00 33 00 31 00 27 44 00 00 00 00 00 43 30 00 Any challenging program, or problem, needs to be broken down into manageable tasks. Start with some simple tasks. First, initialize the 2D array with all 0s and place a 1 in the top-left location. Then complete the method showBoard, which helps by checking if your program logic is correct. Completing these initial steps is not sufficient enough for 44 moves. It does set up the chessboard and display a sequence of moves if any. Furthermore, these first couple of method completions will help to show if you are making progress in the right direction. ONLY DO 44 MOVES TOTAL. PLEASE FOLLOW THE CODE TEMPLATE, DO NOT CHANGE UP ANY NAME OR ANYTHING. DO THE SAME CLASS NAMES AND FORMATTING PLEASE
The purpose is to write a
Knight's Tour is a fascinating problem that is done on an electronic chessboard with a knight. Starting at any location on the chessboard, a knight proceeds to move on the board in such a manner that all positions on the chessboard are visited, once and once only. The knight may only move according to the rules of chess playing.
The matrixes below show a sequence of knight moves that starts from the top-left corner. In most cases, the knight is locked in place and can go no farther. Note: there are only 3 legal knight moves from the 44 locations and they have already been visited.
01 60 39 34 31 18 09 64
38 35 32 61 10 63 30 17
59 02 37 40 33 28 19 08
36 49 42 27 62 11 16 29
43 58 03 50 41 24 07 20
48 51 46 55 26 21 12 15
57 44 53 04 23 14 25 06
52 47 56 45 54 05 22 13
01 22 39 20 03 18 09 16
00 37 02 23 08 15 04 13
35 40 21 38 19 12 17 10
00 00 36 41 24 07 14 05
00 34 00 32 00 28 11 26
00 00 00 00 42 25 06 29
00 00 33 00 31 00 27 44
00 00 00 00 00 43 30 00
Any challenging program, or problem, needs to be broken down into manageable tasks. Start with some simple tasks. First, initialize the 2D array with all 0s and place a 1 in the top-left location. Then complete the method showBoard, which helps by checking if your program logic is correct.
Completing these initial steps is not sufficient enough for 44 moves. It does set up the chessboard and display a sequence of moves if any. Furthermore, these first couple of method completions will help to show if you are making progress in the right direction.
ONLY DO 44 MOVES TOTAL. PLEASE FOLLOW THE CODE TEMPLATE, DO NOT CHANGE UP ANY NAME OR ANYTHING. DO THE SAME CLASS NAMES AND FORMATTING PLEASE
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images