Menu

Task Lab Write Program Move Knight Around Empty Chess Board Leaving Behind Trail Increasin Q43842719

Your task in this lab is to write a program that will move aknight around an empty chess board, leaving behind a trail ofincreasing integers, ranging from 1 to, hopefully, 64. Here are thespecifications for your assignment: 1. The knight will start infirst row and first column (list[0][0]). 2. The program will marksquares as they are visited, ranging from 1-64. 3. The program willcontinue until a complete tour is accomplished (all 64 squares) orthe program gets stuck with nowhere to go. 4. The program willprint the results, looking something like this (use t to align thecolumns):

1 0 21 0 0 14 23 12
20 0 6 9 22 11 0 0
7 2 19 36 15 46 13 24
0 5 8 47 10 37 0 45
0 18 3 16 35 44 25 38
4 31 34 0 42 39 28 0
0 0 17 32 29 26 43 40
0 33 30 0 0 41 0 27
47 squares were visited
5. Use Math.random() to generate the necessary randomnumbers.
6. You will have an OOP class and a client class.
7. Look on the next page for a suggestion on a way to solve thislab.

Provided OOP template

public class Knight {

private int[][] myBoard;

private static final int[] VERT = {1, 2, 2, 1, -1, -2, -2,-1};

private static final int[] HOT = {-2, -1, 1, 2, 2, 1, -1,-2};

private int myRow;

private int myCol;

private int myCount;

public Knight(){

}

public void printBoard() {

}

public void makeMove() {

}

private boolean isLegalMove(int row, int col){
  
}

public boolean isStuck(){

}
}

Expert Answer


Answer to Your task in this lab is to write a program that will move a knight around an empty chess board, leaving behind a trail …

OR