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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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

 

 

Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Labe8vst.java
// This the student starting file for Labes.
Please add your appropriate comments here
$/
import java.text.DecimalFormat;
public class Labesvst
{
public static void main (string[] args)
{
}
int[][] board = new int[8][8];
startBoard (board);
showBoard (board);
/* To Be Completed */
// Initializes the 2D board array with es and 1 at the top-left.
public static void startBoard (int[][] brd)
{
/* To Be Completed */
// Displays a matrix of board values using the 2-digit format.
public static void showBoard (int[][] brd)
{
}
/* To Be Completed */
}
// Used by method nextMove to see if a board location was visited.
public static boolean checkvisit(int[][] brd, int r, int c)
{
/* To Be Completed */
return true;
// Finds a knight-type move to the next location, if possible.
public static void nextMove(int[][] brd)
{
/* To Be Completed */
Transcribed Image Text:Main.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 // Labe8vst.java // This the student starting file for Labes. Please add your appropriate comments here $/ import java.text.DecimalFormat; public class Labesvst { public static void main (string[] args) { } int[][] board = new int[8][8]; startBoard (board); showBoard (board); /* To Be Completed */ // Initializes the 2D board array with es and 1 at the top-left. public static void startBoard (int[][] brd) { /* To Be Completed */ // Displays a matrix of board values using the 2-digit format. public static void showBoard (int[][] brd) { } /* To Be Completed */ } // Used by method nextMove to see if a board location was visited. public static boolean checkvisit(int[][] brd, int r, int c) { /* To Be Completed */ return true; // Finds a knight-type move to the next location, if possible. public static void nextMove(int[][] brd) { /* To Be Completed */
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education