Skip to content

A Java implementation of the classic Battleship game

Notifications You must be signed in to change notification settings

haifromkai/Battleship

Repository files navigation

Table of Contents
  1. About the Project
  2. Built With
  3. Features
  4. Contact

About the Project

Name: Battleship
Started: 4/16/24
Description: The project is a Java implementation of the classic Battleship game, comprising a modular architecture with ten distinct Java classes. It employs object-oriented programming principles, with each ship type (Battleship, Cruiser, Destroyer, Submarine, EmptySea) encapsulated in its respective class inheriting from an abstract Ship class. The Ocean class serves as the game board, managing ship placement and tracking hits and misses. Additional classes handle visual representation, ship placement logic, and player interaction. This project showcases different aspects in Java programming, including inheritance, abstraction, and encapsulation, as well as effective project organization and modular design, resulting in a functional and scalable implementation of the Battleship game.

Built With

Features

Rules

The board will be randomly populated with the following hidden ship:

1 Battleship (Length 4)
2 Cruisers (Length 3)
3 Destroyers (Length 2)
4 Submarines (Length 1)

The player will then select a box to hit by entering a row and column input.

Starting a new game

Screenshot 2024-09-06 at 6 46 18 PM

Choosing a row and column

Screenshot 2024-09-06 at 6 47 34 PM

Hitting a ship

Screenshot 2024-09-06 at 6 47 47 PM

Sinking a ship (sunk ship was of type 'battleship', length = 4 spaces)

Screenshot 2024-09-06 at 6 54 11 PM

Winning the game (all ships were sunk)

Screenshot 2024-09-06 at 7 08 01 PM

Contact

Feel free to leave suggestions or ask questions about any part of the project!
Kai Fang - ([email protected])
Project Link: https://github.com/haifromkai/Battleship

(back to top)

About

A Java implementation of the classic Battleship game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages