-
Notifications
You must be signed in to change notification settings - Fork 0
/
TicTacToeMove.h
54 lines (40 loc) · 1.16 KB
/
TicTacToeMove.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
#ifndef __TICTACTOEMOVE_H
#define __TICTACTOEMOVE_H
#include "GameMove.h"
#include <string>
#include <vector>
#include <iostream>
/*
An OthelloMove encapsulates a single potential move on an OthelloBoard. It
is represented internally by a row and column, both 0-based.
*/
class TicTacToeMove : public GameMove {
private:
int mRow, mCol;
friend class TicTacToeBoard;
TicTacToeMove();
TicTacToeMove(int row, int col);
static int mOutstanding;
public:
/*
static void* operator new(std::size_t sz) {
mOutstanding++;
std::cout << "operator new: " << mOutstanding << " moves outstanding" << std::endl;
return ::operator new(sz);
}
static void operator delete(void* ptr, std::size_t sz) {
mOutstanding--;
std::cout << "operator delete: " << mOutstanding << " moves oustanding" << std::endl;
::operator delete(ptr);
}*/
virtual ~TicTacToeMove() {}
virtual GameMove& operator=(const std::string &);
virtual bool Equals(const GameMove &other) const;
operator std::string() const;
inline bool IsPass() const { return mRow == -1 && mCol == -1; }
virtual GameMove *Clone() const {
return new TicTacToeMove(*this);
}
};
//int OthelloMove::mOutstanding = 0;
#endif