|
@@ -10,7 +10,8 @@ Game::Game()
|
|
|
}
|
|
|
|
|
|
state = NOT_STARTED;
|
|
|
-
|
|
|
+
|
|
|
+ entropyPool = dice.roll();
|
|
|
};
|
|
|
bool Game::addPlayer(std::string name)
|
|
|
{
|
|
@@ -94,7 +95,9 @@ void Game::round()
|
|
|
score();
|
|
|
|
|
|
activePlayer++;
|
|
|
- activePlayer %= players.size();
|
|
|
+ activePlayer %= players.size();
|
|
|
+
|
|
|
+ dice.diceTropy(entropyPool);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -131,29 +134,42 @@ std::string Game::send()
|
|
|
|
|
|
struct Turn Game::receive(std::string userInput)
|
|
|
{
|
|
|
- players[0].currentTurnOlok.clear();
|
|
|
- Turn turn;
|
|
|
+ Turn turnInProgress;
|
|
|
|
|
|
if(1 == userInput.size())
|
|
|
{
|
|
|
- turn.penalty = 1;
|
|
|
+ turnInProgress.penalty = 1;
|
|
|
}
|
|
|
|
|
|
else if(2 == userInput.size())
|
|
|
{
|
|
|
- turn.moves[0] = translateToMove(userInput);
|
|
|
- turn.numberOfMoves = 1;
|
|
|
+ turnInProgress.moves[0] = translateToMove(userInput);
|
|
|
+ turnInProgress.numberOfMoves = 1;
|
|
|
}
|
|
|
|
|
|
else if(4 == userInput.size())
|
|
|
{
|
|
|
- turn.moves[0] = translateToMove(userInput.substr(0,2));
|
|
|
- turn.moves[1] = translateToMove(userInput.substr(2,2));
|
|
|
- turn.numberOfMoves = 2;
|
|
|
+ turnInProgress.moves[0] = translateToMove(userInput.substr(0,2));
|
|
|
+ turnInProgress.moves[1] = translateToMove(userInput.substr(2,2));
|
|
|
+ turnInProgress.numberOfMoves = 2;
|
|
|
}
|
|
|
else {fprintf(stdout, "Form an opinion: WRONG!");}
|
|
|
|
|
|
-
|
|
|
+ if(true == checkTurn(0, turnInProgress))
|
|
|
+ {
|
|
|
+
|
|
|
+ players[0].currentTurnOlok.clear();
|
|
|
+
|
|
|
+ for(int i = 0;i < turnInProgress.numberOfMoves;i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ players[0].currentTurnOlok.addX(turnInProgress.moves[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ players[0].currentTurnOlok.penaltyCount += turnInProgress.penalty;
|
|
|
+ }
|
|
|
+
|
|
|
+ entropyPool += time(NULL);
|
|
|
}
|
|
|
|
|
|
bool Game::isMoveRepresentedInDie(int player, Turn turn)
|