-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenum.h
61 lines (47 loc) · 953 Bytes
/
enum.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Created by Admin on 25/03/2023.
//
#ifndef CHESS_ENUM_H
#define CHESS_ENUM_H
#include <initializer_list>
#include <ranges>
#include <vector>
#include <algorithm>
enum color_enum
{
e_black,
e_white
};
enum type_enum
{
e_empty, e_pawn, e_rook, e_knight, e_bishop, e_queen, e_king
};
enum _move_state
{
invalid_move,
move,
capture,
check,
promotion,
ks_castle,
qs_castle
};
class move_state
{
public:
std::vector<_move_state> states{};
move_state(std::initializer_list<_move_state> list) : states(list)
{};
[[nodiscard]] bool contains(_move_state state) const
{
return std::ranges::any_of(states, [&](const auto& s)
{ return s == state; });
}
move_state() = default;
move_state(const move_state&) = default;
move_state(move_state&&) noexcept = default;
move_state& operator=(const move_state&) = default;
move_state& operator=(move_state&&) noexcept = default;
~move_state() = default;
};
#endif //CHESS_ENUM_H