-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoveFinder.h
More file actions
76 lines (56 loc) · 1.32 KB
/
MoveFinder.h
File metadata and controls
76 lines (56 loc) · 1.32 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* MoveFinder.h
*
* Created on: Jun 20, 2014
* Author: shaun
*/
#ifndef MOVEFINDER_H_
#define MOVEFINDER_H_
#include <vector>
using std::vector;
using std::size_t;
namespace NN
{
class MoveFinder
{
public:
MoveFinder();
virtual ~MoveFinder();
virtual const vector<vector<float>>&
possibleMoves(const vector<float>& current_state, bool side1) = 0;
};
class CheckersMoveFinder : public MoveFinder
{
public:
CheckersMoveFinder();
virtual const vector<vector<float>>&
possibleMoves(const vector<float>& current_state, bool black_player);
private:
const float KING = 1.5;
const float PAWN = 1.0;
vector<vector<float>> m_moves;
vector<float> m_state;
int m_side;
bool
odd(unsigned) const;
float&
pieceAt(size_t row, size_t col);
bool
frontRightJump(size_t row, size_t col);
bool
frontLeftJump(size_t row, size_t col);
bool
backRightJump(size_t row, size_t col);
bool
backLeftJump(size_t row, size_t col);
bool
jump(size_t row, size_t col, float& neighbor, float& target, float& current);
void
findJump(size_t row, size_t col);
bool
tryToJump(float piece, size_t row, size_t col);
void
move(size_t row1, size_t col1, size_t row2, size_t col2);
};
} /* namespace NN */
#endif /* MOVEFINDER_H_ */