-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
39 lines (33 loc) · 830 Bytes
/
Game.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
32
33
34
35
36
37
38
39
#ifndef HW_SOCKET_GAME_H
#define HW_SOCKET_GAME_H
#include <iostream>
#include <array>
#include <vector>
class Game {
public:
Game() = default;
~Game() = default;
bool is_correct_move(size_t x, size_t y, bool player) const;
enum status {
IS_GOING,
MARK_WON,
ZERO_WON,
DRAW
};
status make_move(size_t x, size_t y, bool player);
status get_status() const;
std::string to_string() const;
private:
bool is_mark_move = true;
static const size_t WIDTH = 3;
static const size_t HEIGHT = 3;
enum cell_type {
EMPTY,
MARK, // крестик
ZERO // нолик
};
using field_type = std::array<std::array<cell_type, HEIGHT>, WIDTH>;
field_type field{};
std::vector<field_type> history;
};
#endif //HW_SOCKET_GAME_H