JavaSE Project

Battleship Game

The Battleship puzzle is a captivating logic game, reminiscent of popular puzzles like Sudoku and Nonogram. Featured in prestigious puzzle contests such as the World Puzzle Championship and esteemed puzzle magazines like Game magazine, Battleship presents a unique challenge. This book delves into the complexity of the Battleship game, establishing its NP-complete nature through parsimonious reduction from 3-sat, employing the Java programming language for implementation. In this strategic puzzle, players engage in a Battleship Guessing game, adding a military flair to the logic puzzle genre. The puzzle comprises a 10x10 grid, a column and row tally, and a fleet of ships with varying lengths. The objective is to arrange the ships on the grid while satisfying specific conditions: ensuring all fleet ships are placed, adhering to initial grid indications, preventing adjacent ship placements, and aligning the number of ship segments in each column and row with their respective tallies. Players, whether human or computer, strategically position five distinct ships in the grid. The fleet includes an Aircraft Carrier (size 5), Battleship (size 4), Submarine (size 3), Cruiser (size 3), and Destroyer (size 2). This engaging game not only provides a mental challenge but also incorporates elements of strategy, making it a dynamic and enjoyable pursuit for puzzle enthusiasts and strategic thinkers alike.

Functional Requirements

End User:

Attack: The system should return the status of an attack on a grid and indicate whether or not it was a hit.

Sink ship: The system should be able to tell when a ship has been sunk and inform the user.

Sunk all ships: Once all the ships have been sunk on one side of the board, the system should output win/loss information to the user.

System:

  1. The system should be able to randomly place the computer player’s ships so as none are overlapping and all are within the bounds of the array.

  2. The system should be able to count and keep track of all attacks made by both players and also the ratio of successful hits to attacks.

  3. The system should be able to show when a ship has been hit.

  4. The system should be able to tell when win/loss point in the game has been reached.

  5. The system should be able to restart a new game at the end of the game or reset in the middle of play.

Non-functional Requirements

  1. Performance: The user should not be left waiting an unreasonable amount of time for the computer to make his move.

  2. Learnability: The system include explanation about game and user can learn easily.

  3. Availability: The system must run without any errors or failure whenever required.

  4. Usability: The system is easy to use.

P.S. This project is Final Year Capstone Project.


  • All Pages
Image

Page 1

+
Image

Page 2

+
Image

Page 3

+
Image

Page 4

+
Image

Page 5

+
Image

Page 6

+