"Warships" is a classic battleship game where two players attempt to sink each other's fleets. Each player has a 10x10 grid on which they place their ships. The objective of the game is to guess the coordinates of the opponent's ships and sink them before the opponent sinks yours.
-
Setting Up Ships:
- Each player has a fleet consisting of the following ships:
- 1x Aircraft Carrier (5 cells)
- 2x Battleship (4 cells)
- 3x Cruiser (3 cells)
- 2x Destroyer (2 cells)
- Ships can be placed horizontally or vertically, but they cannot touch or overlap.
- Each player has a fleet consisting of the following ships:
-
Gameplay:
- Players take turns guessing coordinates on the opponent's grid (e.g., A5, C3).
- If a guess is a hit, the player marks it on their hit grid.
- The game ends when all ships of one player are sunk.
To install the game "Warships", follow these steps:
- Download the repository:
git clone https://github.com/ThaikoZ/gra-w-statki.git
- Navigate to the game directory:
cd gra-w-statki/gra-w-statki
- Compile the project:
g++ -o gra-w-statki gra-w-statki.cpp Game.cpp Player.cpp Ships.cpp ShipsInConsole.cpp Engine.cpp
To start the game, use the following command in the terminal:
./gra-w-statki
- Setting Ships: Enter the starting and ending coordinates of the ship.
- Attack: Enter the coordinates of the cell you want to attack (e.g., B7).
- Adrian Sudak - Project author.
This project is licensed under the MIT License.
gra-w-statki/
│
├── gra-w-statki/ # Project directory
│ # Header files
│ ├── Player.h
│ ├── Ships.h
│ ├── ShipsInConsole.h
│ ├── Game.h
│ └── Engine.h
│ # Source files
│ ├── gra-w-statki.cpp
│ ├── Player.cpp
│ ├── Ships.cpp
│ ├── ShipsInConsole.cpp
│ ├── Game.cpp
│ └── Engine.cpp
└── README.md # README file
- C++ - Main programming language
- Console - User interface
#include "ShipsInConsole.h"
using namespace std;
int main() {
ShipsInConsole ships;
ships.play();
return 0;
}
This project is part of the Object-Oriented Programming course requirements.