ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

Battleship game

by | Nov 30, 2023 | questions

I need help in simplebattleshipgame. – CMSC 401
Spring 2013

Program 6 – Battleships1

Program name: bs.

Document Preview:

CMSC 401
Spring 2013

Program 6 – Battleships1

Program name: bs.java
ZZ

The puzzle described below is a solitaire version of the classic paper and pencil game of Battleships. The grid represents a section of the ocean in which the entire fleet is hiding. This fleet consists of one battleship (four grid squares in length), two cruisers (each three squares long), three destroyers (each two squares long), and four submarines (one square each). The ships may be oriented either horizontally or vertically, and NO TWO SHIPS WILL OCCUPY ADJACENT GRID SQUARES, EVEN DIAGNOLLY. The digits along the right side of and below the grid indicate the number of grid squares in the corresponding rows and columns that are occupied by vessels.

In the puzzle, certain “shots” may have been taken to start you off. These may show ocean (O), a complete submarine (U), or the middle (M) or the end (N, S, E, W) of a longer vessel. Your task is to determine where the fleet is located.

A sample puzzle is:

1 0 1 N 7 1 M 3 1 O 4 0 2 2 1 1 3 1 4 2 3 1 2

To facilitate data entry, the following will be in effect:

1. Input will be found in a file specified as a command line argument.

2. This file will consist of the following
Row 1 10 numeric values representing the “hits for each row.
Row 2 10 numeric values representing the “hits for each column.
Row 3 a numeric value representing the number of “shots taken.
Row 4.. Two integers representing the coordinates of the shot followed by 1 space
and a character representing the results of the shot. Indices begin at 0.

3. The results of the shots are as follows
O Water
U Submarine
S The south end of a vertical ship.
W The west end of a horizontal ship.
N The north end of a vertical ship.
E The east end of a horizontal ship.
M The middle of a ship (may be either…

Attachments:


ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!