/Battleships_Game

This is a replica of the classic Battleship board game. This program was written entirely in C++ as a personal project in my learning journey.

Primary LanguageC++

Battleships

Description

This is a replica of the classic Battleship board game. This program was written entirely in C++ as a personal project in my learning journey.

Installation

Clone this repository, open the Battleship folder, and launch the Battleship.exe application.
https://github.com/Mo2Hefny/Battleships_Game

To launch your executable file in case you played with the code, open the following path. x64/Debug/Battleship.exe.

Environment

This project was built on Visual Studio using the SFML library.

Gameplay

After running the .sln file, the title screen should look like this:

battleship_main_menu

The game currently supports playing Versus AI mode only.

I. Preparation Phase

To place a ship, select it from the Ships section and move it to the desired location with your keyboard. Your AI opponent has already placed his ships.

image

Once you've legally placed all your ships, you can start the game by hitting Enter.

II. Gameplay Phase

The goal is to find and sink all enemy ships before they find and sink all of yours.

gameplay_phase

Once a player has found and destroyed all 5 enemy ships, the game ends.

AI Strategies

The current implementations of various strategies to challenge the player:

  • Random Targeting: shoots at a random spot till it finds an enemy ship, BUT it won't target spots that can't hold the smallest still living ship.

hit_target

  • Finishing Ship: if a ship was found, the AI chooses a random direction to shoot beside the initial hit position till it finds the right path and destroys the ship.

finish_ship

  • Checking Other Ships: checks if another ship was hit while destroying and finishing the found ship.

hit_path