forked from gameprogcpp/code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.h
More file actions
32 lines (27 loc) · 855 Bytes
/
Board.h
File metadata and controls
32 lines (27 loc) · 855 Bytes
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
// ----------------------------------------------------------------
// From Game Programming in C++ by Sanjay Madhav
// Copyright (C) 2017 Sanjay Madhav. All rights reserved.
//
// Released under the BSD License
// See LICENSE in root directory for full details.
// ----------------------------------------------------------------
#pragma once
#include <vector>
class BoardState
{
public:
enum SquareState { Empty, Red, Yellow };
BoardState();
std::vector<BoardState*> GetPossibleMoves(SquareState player) const;
bool IsTerminal() const;
float GetScore() const;
SquareState mBoard[6][7];
protected:
bool IsFull() const;
int GetFourInARow() const;
float CalculateHeuristic() const;
};
// Try to place the player's piece
bool TryPlayerMove(class BoardState* state, int column);
// Make the next CPU move
void CPUMove(class BoardState* state);