-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathlogic.cpp
More file actions
32 lines (27 loc) · 769 Bytes
/
logic.cpp
File metadata and controls
32 lines (27 loc) · 769 Bytes
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
32
#include "logic.h"
#include <cstdlib>
#include <iostream>
bool **create_board(const int height, const int width) {
bool **board = (bool **)malloc(sizeof(bool *) * height);
for (int i = 0; i < height; i++) {
board[i] = (bool *)malloc(sizeof(bool) * width);
}
return board;
}
void destroy_board(bool **board, const int height) {
for (int i = 0; i < height; ++i) {
free(board[i]);
}
free(board);
}
void place_ships(bool **board, const int shipcount, const int width,
const int height) {
// TODO implement this function
}
void find_ships(bool **board, const int width, const int height) {
// TODO implement
}
ResponseType guess(bool **board, const int x, const int y) {
// TODO implement this
return ResponseType::HIT;
}