Generation

generate functionSun, 13 Nov 2022

Fox and hound game

// Fox and Hound -- Data Structures public class FoxAndHoundGame { // constants to be used as indices public static final int BLANK = 0; public static final int FOX = 1; public static final int HOUND = 2; // constants to be used as return values public static final int FOX_WINS = 0; public static final int HOUND_WINS = 1; public static final int DRAW = 2; public static final int INCOMPLETE = 3; private int[][] board; private int turn; public FoxAndHoundGame() { // allocate space for the board board = new int[8][8]; // fill the board with blanks for (int r = 0; r < 8; r++) for (int c = 0; c < 8; c++) board[r][c] = BLANK; // place the pieces on the board board[0][0] = FOX;

Questions about programming?Chat with your personal AI assistant