-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMoveList.h
43 lines (37 loc) · 885 Bytes
/
MoveList.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
/*
* File: MoveList.h
* Author: pj
*
* Created on January 16, 2013, 2:54 PM
*/
#ifndef MOVELIST_H
#define MOVELIST_H
#include "Common.h"
#include "Board.h"
const int MAX_MOVELIST_LENGTH = 256;
class MoveList {
private:
int size;
U32 data[MAX_MOVELIST_LENGTH];
public:
MoveList() { size = 0; }
void inline push(U32 move) {
#ifdef DEBUG
assert(size < MAX_MOVELIST_LENGTH);
#endif
data[size++] = move;
}
U32 inline pop() {
#ifdef DEBUG
assert(size > 0);
#endif
return data[--size];
}
void inline reset() { size = 0; }
U32 inline operator[](const int idx) const { return data[idx]; };
int inline length() const { return size; }
bool contains(U32 move);
bool contains_duplicates();
bool contains_valid_moves(const class Board &board);
};
#endif /* MOVELIST_H */