Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code for board.java : package battleship; public class Board { // The height and width of the board, in squares. Note that this may //
Code for board.java :
package battleship; public class Board { // The height and width of the board, in squares. Note that this may // change without notice! public static final int HEIGHT = 10; public static final int WIDTH = 10; // Cheating detector, with package visibility so mischievous students // can't tamper with it. boolean firedAtThisRound; // Change this to "true" only if you're using Linux and the command // line. public static boolean GOOD_OPERATING_SYSTEM = false; /** * Constructor that takes a 2-dimensional array of characters as an * argument. The array *must* represent a legitimate board, otherwise * an Exception will be thrown. A "legitimate" board is one that has * exactly five overlapping ships of the proper length (A - length 5, * B - length 4, S - length 3, D - length 3, P - length 2) and has all * other squares set to ' ' (space.) */ public Board(char[][] contents) throws Exception { squares = contents; if (!legit()) { throw new Exception("Bad board! " + toString(0)); } for (int i = 0; i
I need help making the go() method, the hideships() method, and the reset() method. If it could all be done, that would be great. This is in Java programming by the way.
For the Battleship Project, you will write a program that plays the game Battleship. Your program will implement a gaming algorithm that maintains a state, uses 2-dimensional arrays, and double dispatch. If you submit a working program, your program will compete in live game play against your fellow students to see who implements the best Battleship algorithm For the Battleship Project, you will write a program that plays the game Battleship. Your program will implement a gaming algorithm that maintains a state, uses 2-dimensional arrays, and double dispatch. If you submit a working program, your program will compete in live game play against your fellow students to see who implements the best Battleship algorithm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started