Boost Your Grades With Us Today!

support@writernursing.com      Contact us +1 (332)-240-3699

Browse Over 3 Million Questions

We have made it easier for you to place an order

+1 (332) 240-3699

support@writernursing.com

Connect With Us For a Fruitful Engagement

student_PNG181-2.png

Computer Science homework help

Your task in this assignment is to implement a simplified guessing game, hinted by a well-known plastic board game called Battleship. The computer arranges ships on the grid structure in which each ship occupies a number of consecutive positions on the grid. Those ships are arranged either horizontally or vertically. The number of positions for each ship is determined by the type of the ship. The ship cannot overlap and only one ship can occupy any given position in the grid. You can play a real version on the web such as this to get an idea. The version to realize in this assignment is simpler and a one-man based game in which you are bombing those ships generated by your computer. The next sample session will illustrate the entire scheme:

There are 6 ships. Must bomb 18 places to destroy all…
<<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 . . . . . . . . . .
3 . . . . . . . . . .
4 . . . . . . . . . .
5 . . . . . . . . . .
6 . . . . . . . . . .
7 . . . . . . . . . .
8 . . . . . . . . . .
9 . . . . . . . . . .
10 . . . . . . . . . .

Enter position, “show”, “init” or “quit”: 4 G
You missed 🙁
<<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 . . . . . . . . . .
3 . . . . . . . . . .
4 . . . . . . – . . .
5 . . . . . . . . . .
6 . . . . . . . . . .
7 . . . . . . . . . .
8 . . . . . . . . . .
9 . . . . . . . . . .
10 . . . . . . . . . .

Enter position, “show”, “init” or “quit”: 8 b
You hit 🙂
<<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 . . . . . . . . . .
3 . . . . . . . . . .
4 . . . . . . – . . .
5 . . . . . . . . . .
6 . . . . . . . . . .
7 . . . . . . . . . .
8 . @ . . . . . . . .
9 . . . . . . . . . .
10 . . . . . . . . . .

Enter position, “show”, “init” or “quit”: show
<<Pacific Ocean>>
A B C D E F G H I J
1 . * . . * * * . . .
2 . * . . . . . . . .
3 . * . . * . . . . .
4 . . . . * . – . . .
5 . . . . * . . . * *
6 . . . * * . . . . .
7 . * . * . . . . . .
8 . @ . * . . . . . .
9 . * . . . . . . . .
10 . * . . . . . . . .

Enter position, “show”, “init” or “quit”: 8 B
You bomed same place… You missed 🙁
<<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 . . . . . . . . . .
3 . . . . . . . . . .
4 . . . . . . – . . .
5 . . . . . . . . . .
6 . . . . . . . . . .
7 . . . . . . . . . .
8 . @ . . . . . . . .
9 . . . . . . . . . .
10 . . . . . . . . . .

Enter position, “show”, “init” or “quit”: init
There are 6 ships. Must bomb 18 places to destroy all…
<<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 . . . . . . . . . .
3 . . . . . . . . . .
4 . . . . . . . . . .
5 . . . . . . . . . .
6 . . . . . . . . . .
7 . . . . . . . . . .
8 . . . . . . . . . .
9 . . . . . . . . . .
10 . . . . . . . . . .

Enter position, “show”, “init” or “quit”: show
   <<Pacific Ocean>>
A B C D E F G H I J
1 . . . . . . . . . .
2 * . . . . . . . . .
3 * . . . . * . . . .
4 * . . . . * . . . .
5 * . . . . * . . . .
6 . * . . . . * * * *
7 . * . . . . . . . .
8 . * . . * * . . . .
9 . . . * . . . . . .
10 . . . * . . . . . .

Enter position, “show”, “init” or “quit”: quit
Bye…

The default board size is 10 x 10 and the computer arranges 6 ships of sizes between 2 and 4. The user can type in the position to aim and hit by a space-delimited pair of a row position (number) and a column position (alphabet) of the grid.  The result is hit or miss and is shown with ‘@’ or ‘-‘ respectively at the chosen position of the board.  The dot ‘.’ indicates a position for choice.  A command “show” discloses the computer’s arrangement of ships using ‘*’ (as well as ‘@’ at a damaged position). The command “init” is to reset the game by rearranging ships. The game is over when all the ships are destroyed. The ship arrangement is random. Generation either horizontal or vertical layout is also chosen at random.

 

Do you need a similar assignment written for you from scratch? We have qualified writers to help you.
You can rest assured of an A+ quality paper that is plagiarism free. Order now for an Amazing Discount!
Use Discount Code "NewClient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we write an original paper exclusively for you.

What Students Get

Free Features

We Offer Custom Writing Services with 3 Key Benefits

Affordable Writing Service

We guarantee a perfect price-quality balance to all students. The more pages you order, the less you pay.

The Best Support Service

Get 24⁄7 help with proofreading and editing your draft – fixing your grammar, spelling, or formatting.

Quality Essay Help

Our team of professional writers guarantees top-quality essay writing results.