-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cpp
71 lines (56 loc) · 1.29 KB
/
Game.cpp
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
// Game.cpp
#include "provided.h"
class GameImpl
{
public:
GameImpl(int nColumns, int nLevels, int N, Player* red, Player* black);
bool completed(int& winner) const;
bool takeTurn();
void play();
int checkerAt(int c, int r) const;
};
GameImpl::GameImpl(int nColumns, int nLevels, int N, Player* red, Player* black)
{
}
bool GameImpl::completed(int& winner) const
{
return true; // This is not always correct; it's just here to compile
}
bool GameImpl::takeTurn()
{
return false; // This is not always correct; it's just here to compile
}
void GameImpl::play()
{
}
int GameImpl::checkerAt(int c, int r) const
{
return VACANT; // This is not always correct; it's just here to compile
}
//******************** Game functions *******************************
// These functions simply delegate to GameImpl's functions.
// You probably don't want to change any of this code.
Game::Game(int nColumns, int nLevels, int N, Player* red, Player* black)
{
m_impl = new GameImpl(nColumns, nLevels, N, red, black);
}
Game::~Game()
{
delete m_impl;
}
bool Game::completed(int& winner) const
{
return m_impl->completed(winner);
}
bool Game::takeTurn()
{
return m_impl->takeTurn();
}
void Game::play()
{
m_impl->play();
}
int Game::checkerAt(int c, int r) const
{
return m_impl->checkerAt(c, r);
}