We're Open
+44 7340 9595 39
+44 20 3239 6980

[Solved] You should write a Java program by developing a game based on the classic game Battleships

  100% Pass and No Plagiarism Guaranteed

[Solved] You should write a Java program by developing a game based on the classic game Battleships

Software Development

 

You should write a Java program to meet the specification shown below.

Specification

 You are to develop a game based on the classic game Battleships.

Quick Overview

In your game, the computer will randomly place 5 different ships into a 10 x 10 grid. The player will then be able to select and individual square from the grid to fire at. If a ship is on that square, the ship is sunk the player gains points. After the player has had ten shots the game ends and the player’s score is displayed. The game can end before ten moves if the player sinks all the ships.

More Details

The game is played on a 10 x 10 grid like so

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Although in the game, there is never any reason to display the grid. The computer randomly assigns five ships to the grid ensuring that they do not overlap. The ships can be placed horizontally or vertically but not diagonally. The ships are all different sizes and worth different amount of points if shot as shown below.

 

Ship                            No of squares            Points

Aircraft Carrier            5                                  2         

Battleship                    4                                  4

Submarine                  3                                  6

Destroyer                    2                                  8

Patrol boat                   1                                  10

 

Therefore, after the computer has allocated the ships the grid might look like this

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


The game starts and the player has no points. They are then asked which square they would like to shoot at (they can’t see the grid). The program informs the player if they have missed or hit a ship. If they have hit a ship, they are told which ship and how many points it is worth. Once a ship has been hit, it “sinks” and so cannot be hit again.

Game End

There are two ways the game can end. After 10 shots or when all ships have been sunk. If the player sinks all the ships with 10 or less shots, the game ends. If the player hasn’t sunk all the ships, the game ends after the tenth shot.

Once the game has ended the program displays which ships were shot and the total number of points the player has.

Debug Mode

When the program starts, the player will be asked if they wish to play in debug mode. If they select yes then the locations of the ships will be displayed when the player chooses his square to fire at. For example, the display might look like this   

 

Aircraft Carrier            (2, 2) (3, 2) (4, 2) (5, 2) (6, 2) 

Battleship                    (1, 5) (1, 6) (1, 7) (1, 8)

Submarine                  (5, 8) (5, 9) (5, 10)

Destroyer                    (3, 5) (4, 5)

Patrol boat                   (9, 3)

                                                    

Please enter the next square to fire at:

 

When the program is not in debug mode, the locations of the ships are not displayed.

Advanced Features

The following features are optional but are worth extra marks (as shown in the marks breakdown).

Prevent the user from firing at the same square twice

If the user tries to enter, a square they have already fired at they should be told they can’t fire at that square and the attempt does not count as one of their ten shots.

Save Game Status

The player should be able to stop the game part way through and the game status is serialized. When the program exits and starts up again the player should be asked if they wish to start a new game or load a saved game.

High Score Table

The program should keep a list of names and high scores. The high score table must be maintained when the program has been shut down and started up again and so it is able to save users from different sessions.

Report

You should write a report about your work. Your report should discuss

  • Your design (including class diagram)
  • How you represented the grid
  • How you prevented ships overlapping
  • Any of the advanced features implemented

                                                       

Marking Scheme

Marks will be allocated as follows

 

Functionality                            50%

Design and use of grid            20%

Report                                     10%

Advanced Features                20%

  • Prevent the user from firing at the same square twice (4%)
  • Save Game Status (8%)
  • High Score Table (8%)

 

 

 


100% Plagiarism Free & Custom Written,
Tailored to your instructions


International House, 12 Constance Street, London, United Kingdom,
E16 2DQ

UK Registered Company # 11483120


100% Pass Guarantee

STILL NOT CONVINCED?

View our samples written by our professional writers to let you comprehend how your work is going to look like. We have categorised this into 3 categories with a few different subject domains

View Our Samples

We offer a £ 2999

If your assignment is plagiarised, we will give you £ 2999 in compensation

Recent Updates

Details

  • Title: [Solved] You should write a Java program by developing a game based on the classic game Battleships
  • Price: £ 108
  • Post Date: 2021-10-12T09:16:10+00:00
  • Category: Recent Student Quires
  • No Plagiarism Guarantee
  • 100% Custom Written

Customer Reviews

[Solved] You should write a Java program by developing a game based on the classic game Battleships [Solved] You should write a Java program by developing a game based on the classic game Battleships
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

The writer 0223 is really helpful. He gave me the best essay ever. Love you loads for such a great job and thanks again.
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

Now I am happy that I made the right decision of coming to Insta Research for help. My term paper was so technical and analytical at the same time. I got really confused about what to do but got relaxed when I was given such a humble writer. He clarified my concepts with the best explanations and discussions. I almost interacted with him on daily basis within the writing process. The best feature of this site is quick delivery as I got the work before my deadline. Additionally, the term paper is written skillfully and handled quite professionally. Now I am able to take a deep sigh of relief and thank you all for such speedy help. The quality of the work made my day.