forked from ProgrammingCCC/battleship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logic.h
31 lines (22 loc) · 782 Bytes
/
logic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
struct Coordinates {
int x, y;
bool operator==(const Coordinates& rhs)
{
return this->x == rhs.x && this->y == rhs.y;
}
};
enum ResponseType { HIT, MISS, NEAR_MISS };
/// Board Initializer
bool **create_board(const int width, const int height);
/// Board Destructor
void destroy_board(bool **board, const int height);
// place ships function
void place_ships(bool **board, const int ship_count, const int width,
const int height);
// find ships function
Coordinates *find_ships(bool **board, const int width, const int height,
const int ship_count);
ResponseType guess(bool **board, const int x, const int y,
const int height, const int width);
void print_board(bool **board, const int width, const int height);