Battleship Simulation on JAVA


 Battleship Simulation on JAVA(please can you add comments for the code so that I can understand the problem)

You will write a program to play a version of the game of Battleship against the computer. Our simplified version of the game will be played on a single 8 by 8 grid. Before the actual game, each player secretly places 6 ships and 4 grenades on the grid. Ships and grenades are a single position on the grid. The position of these ships and grenades are of course hidden from the opponent. Once both players have placed their ships and grenades, the actual game starts. Each player, in turn, “shoots a rocket” on the grid(i.e. Calls a position)

– If the rocket (the position called) falls on a position where there is nothing, then nothing happens, and the other player can shoot his/her rocket.

– If the rocket falls on a coordinate where the opponent (or the player) has a grenade, then the player loses a turn, and next time, the opponent will play twice in a row.

– If the rocket falls on a coordinate where the opponent (or the player…) has a ship, then that ship sinks.

– If the rocket falls on a coordinate that has been called before, regardless of what was there before, nothing happens. (So, for example, a grenade can only explode once).

 The goal of the game is to sink all of your opponent’s ships before your opponent sinks yours.

For the sake of simplicity, you can assume that ships and grenades cannot overlap. So, you cannot have 2 grenades on the same position, have 2 ships on the same position, or have a grenade on a ship.

For example, let’s consider the following grid

Calendar Description automatically generated

Here, one player (identified in black) has his/her 6 ships at positions A1, G1, A4, C4, G4 and A6 and 4 grenades at positions D1, B6, B7 and H6. The other player has his/her ships at H2, A3, E3, H4, E5 and C8 and 4 grenades at positions H1, B2, C6 and H7.

If black starts the game and “shoots a rocket” at position D2 then nothing happens, and we have the following grid.

Calendar Description automatically generated

It is white’s turn now. White shoots at G4. The rocket hits one of black’s ship. The ship sinks. We now have:

Calendar Description automatically generated

Black shoots at H1. The rocket hits a grenade. Black will lose a turn. We now have:

Calendar Description automatically generated

White shoots at H8. Nothing.

A picture containing clock, photo, sitting, mounted Description automatically generated

White shoots again (remember, black lost a turn). White shoots at G1. It sinks another of

black’s ships.

Calendar Description automatically generated

White plays now. He is a bit confused and shoots at H4. He just sunk his own ship…

Calendar Description automatically generated

White shoots at a safe position H1. It is a grenade that already exploded. Nothing happens.

Calculate the price of your order

Simple Order Process

Fill in the Order Form

Share all the assignment information. Including the instructions, provided reading materials, grading rubric, number of pages, the required formatting, deadline, and your academic level. Provide any information and announcements shared by the professor. Choose your preferred writer if you have one.

Get Your Order Assigned

Once we receive your order form, we will select the best writer from our pool of experts to fit your assignment.

Share More Data if Needed

You will receive a confirmation email when a writer has been assigned your task. The writer may contact you if they need any additional information or clarifications regarding your task

Let Our Essay Writer Do Their Job

Once you entrust us with your academic task, our skilled writers embark on creating your paper entirely from the ground up. Through rigorous research and unwavering commitment to your guidelines, our experts meticulously craft every aspect of your paper. Our process ensures that your essay is not only original but also aligned with your specific requirements, making certain that the final piece surpasses your expectations.

Quality Checks and Proofreading

Upon the completion of your paper, it undergoes a meticulous review by our dedicated Quality and Proofreading department. This crucial step ensures not only the originality of the content but also its alignment with the highest academic standards. Our seasoned experts conduct thorough checks, meticulously examining every facet of your paper, including grammar, structure, coherence, and proper citation. This comprehensive review process guarantees that the final product you receive not only meets our stringent quality benchmarks but also reflects your dedication to academic excellence.

Review and Download the Final Draft

If you find that any part of the paper does not meet the initial instructions, send it back to us with your feedback, and we will make the necessary adjustments.