Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a group project requiring us to make a battleship game (instructions below). We have one group member coding a ship object, another coding

This is a group project requiring us to make a battleship game (instructions below). We have one group member coding a ship object, another coding the UI Board, another coding the AI and I have to code the ocean object/board. The information I have on the ocean board is as follows: Ocean object/board = contains ships - private ship grid (8x8 grid) The methods it should have are: addShip method, fireAtCoordinate method (returns boolean to check if a hit or miss), scanCoord method (returns whatever is in coordinate). Please write the code for the ocean board class. *I am using JGrasp so please make sure it is compatible *Please comment throughout code

image text in transcribed

9. One-player Battleship Game On an 8 x 8 grid allow a player to choose locations for 3 boat objects (one of length 2, one of length 3, one of length 4) and have the computer randomly do the same thing (make sure they all fit on the grid. Alternate turns between the human player and the computer and when a battleship is sunk print "You Sunk my Battleship! the game is over when all three of one players ships are sunk. The computer could just use the Math rand function to guess a place to attack but you can also make it smarter by keeping an array of points where it scored a hit and then adding to that. More information here: http://en. wikipedia.org/wiki/Battleship (game)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions