//board.h
//by John Ahlschwede
//defines board class

#include "player.h"



///////////////////////////////////////////////////////////////////////////////
// board class
///////////////////////////////////////////////////////////////////////////////

/*
1st player board [as stored in index]
.--------------------------------------------.
| .---. .--. .--. .--. .--. .--. .--. .---.  |
| |   | |13| |12| |11| |10| | 9| | 8| |   |  |
| | 0 | '--' '--' '--' '--' '--' '--' | 7 |  |
| |   | .--. .--. .--. .--. .--. .--. |   |  |
| |   | | 1| | 2| | 3| | 4| | 5| | 6| |   |  |
| '---' '--' '--' '--' '--' '--' '--' '---'  |
'--------------------------------------------'

[cups 0 and 7 are known as the mancalas]


2nd player board [interpreted]
.--------------------------------------------.
| .---. .--. .--. .--. .--. .--. .--. .---.  |
| |   | | 6| | 5| | 4| | 3| | 2| | 1| |   |  |
| | 7 | '--' '--' '--' '--' '--' '--' | 0 |  |
| |   | .--. .--. .--. .--. .--. .--. |   |  |
| |   | | 8| | 9| |10| |11| |12| |13| |   |  |
| '---' '--' '--' '--' '--' '--' '--' '---'  |
'--------------------------------------------'


INDEX	2nd player reads as
0		7
1		8
2		9
3		10
4		11
5		12
6		13
7		0
8		1
9		2
10		3
11		4
12		5
13		6


*/


class board
{
private:
	int cups[14];
	player *firstPlayer;
	player *secondPlayer;
	int scoreFirstPlayer; //points scored by first player since start of play (NOT total beads in mancala)
	int scoreSecondPlayer; 
	bool firstPlayersTurn; //is TRUE when it's the first player's turn

public:
	board();
	bool playSetTurns(player *, player *, int); //play for a set number of turns
	bool playGame(player *, player *); //play a whole game
	void randomizeBoard(); //randomly place 48 stones on board, such that game isn't over
	void boardInit();
	void printResults();
	int getFirstScore() {return scoreFirstPlayer;}
	int getSecondScore() {return scoreSecondPlayer;}
	bool move(int); //return true if player gets another turn, false otherwise
	int formatMove(int); //translates move into usable input
	bool gameOver(); //returns TRUE and moves last pieces if game is over
	void setCups(int[]); //sets the cups array to the array passed in
	int *getCups();//returns cups array
	bool getTurn();
	void setTurn(bool newTurn) {firstPlayersTurn = newTurn;}
	int getRating(); //returns cups[7] - cups[0]
};
