| 1234567891011121314151617181920212223242526272829303132 |
- // ----------------------------------------------------------------
- // 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);
|