|
@@ -30,7 +30,7 @@ void Game::score()
|
|
|
// clear each players' previous score
|
|
|
players[i].score = 0;
|
|
|
// calculate penalty amount
|
|
|
- players[i].score -= players[i].penaltyCount*PENALTY_VALUE;
|
|
|
+ players[i].score -= players[i].cumulativeOlok.penaltyCount*PENALTY_VALUE;
|
|
|
// check each color(row) on ScoreSheet
|
|
|
for(int j = 0;j <white1;j++)
|
|
|
{
|
|
@@ -38,7 +38,7 @@ void Game::score()
|
|
|
// check each box in row
|
|
|
for(int k =0;k <CHECKBOXES;k++)
|
|
|
{
|
|
|
- if(true == players[i].rowColors[j][k])
|
|
|
+ if(true == players[i].cumulativeOlok.grid[j][k])
|
|
|
{
|
|
|
count++;
|
|
|
}
|
|
@@ -51,7 +51,7 @@ void Game::score()
|
|
|
for(int i = 0;i<players.size();i++)
|
|
|
{
|
|
|
// check for maximum penalty to see if game is over
|
|
|
- if(players[i].penaltyCount == MAX_PENALTY){state = FINISHED;}
|
|
|
+ if(players[i].cumulativeOlok.penaltyCount == MAX_PENALTY){state = FINISHED;}
|
|
|
}
|
|
|
// check for lockout to see if game is over
|
|
|
int lockCount = 0;
|
|
@@ -84,29 +84,24 @@ void Game::turn(ScoreSheet activePlayer)
|
|
|
if(temp){break;}
|
|
|
Sleep(1);
|
|
|
}
|
|
|
- // add selection to players' cards
|
|
|
+ // save data from currentTurnOlok into cumulativeOlok
|
|
|
for(int i = 0; i <players.size();i++)
|
|
|
{
|
|
|
- int t;
|
|
|
- // everyone can select a color and a check box
|
|
|
- if(-1<(t = players[i].selection[everyone][row]))
|
|
|
+ // find changes in currentTurnOlok and transfer to cumulativeOlok
|
|
|
+ for(int j = 0;j < players[i].currentTurnOlok.grid.size();j++)
|
|
|
{
|
|
|
- int color = players[i].selection[everyone][row];
|
|
|
- int checkbox = players[i].selection[everyone][column];
|
|
|
- players[i].rowColors[color][checkbox] = true;
|
|
|
- }
|
|
|
- // active player can select a color and check box
|
|
|
- if(-1<(t = players[i].selection[active][row]))
|
|
|
- {
|
|
|
- int color = players[i].selection[active][row];
|
|
|
- int checkbox = players[i].selection[active][column];
|
|
|
- players[i].rowColors[color][checkbox] = true;
|
|
|
+ for(int k = 0;k < players[i].currentTurnOlok.grid[j].size();k++)
|
|
|
+ {
|
|
|
+ // check for true values in currentTurnOlok's grid
|
|
|
+ if(true == players[i].currentTurnOlok.grid[j][k])
|
|
|
+ {
|
|
|
+ // transfer true values from currentTurnOlok's grid to cumulativeOlok's grid
|
|
|
+ players[i].cumulativeOlok.grid[j][k] = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// player selects to add penalty, increase the penalty count
|
|
|
- if(0<(t = players[i].selection[penalty][0]))
|
|
|
- {
|
|
|
- players[i].penaltyCount++;
|
|
|
- }
|
|
|
+ players[i].cumulativeOlok.penaltyCount += players[i].currentTurnOlok.penaltyCount;
|
|
|
}
|
|
|
// score the cards
|
|
|
score();
|
|
@@ -122,21 +117,21 @@ std::string Game::send()
|
|
|
{
|
|
|
output.push_back(dice.dice[i] + '0');
|
|
|
}
|
|
|
- // look at each player card
|
|
|
+ // look at each scoresheet
|
|
|
for(int i = 0; i < players.size(); i++)
|
|
|
{
|
|
|
- // check each row on the player's card
|
|
|
- for(int j = 0; j < white1; j++)
|
|
|
+ // check each row on the grid on the scoresheet
|
|
|
+ for(int j = 0; j < players[i].cumulativeOlok.grid.size(); j++)
|
|
|
{
|
|
|
- // check each box on the player card and then store output
|
|
|
- for(int k = 0; k < CHECKBOXES;k++)
|
|
|
+ // check each box on the row and then store output
|
|
|
+ for(int k = 0; k < players[i].cumulativeOlok.grid[j].size();k++)
|
|
|
{
|
|
|
// look at checkbox value, add it to output
|
|
|
- output.push_back(players[i].rowColors[j][k] ? 'T' : 'F');
|
|
|
+ output.push_back(players[i].cumulativeOlok.grid[j][k] ? 'T' : 'F');
|
|
|
}
|
|
|
}
|
|
|
// add penalty count to output
|
|
|
- output.push_back(players[i].penaltyCount + '0');
|
|
|
+ output.push_back(players[i].cumulativeOlok.penaltyCount + '0');
|
|
|
}
|
|
|
// add locked off row to output
|
|
|
for(int i = 0; i < lockOut.size();i++)
|
|
@@ -156,17 +151,13 @@ std::string Game::send()
|
|
|
// "1"
|
|
|
void Game::receive(std::string userInput)
|
|
|
{
|
|
|
- players[0].newSelection();
|
|
|
+ players[0].currentTurnOlok.clear();
|
|
|
// penalties are marked to card if user string = 1
|
|
|
- players[0].selection[penalty][0] = 1;
|
|
|
// did the user send a number?
|
|
|
// if a user did not send a number no changes take place
|
|
|
// take the userinput (string) and parse it into parts
|
|
|
// what is the length of the userInput? length of 2, 4? (boxes 0-9 are represented as 00,01,02...)
|
|
|
- players[0].selection[everyone][row] = green;
|
|
|
- players[0].selection[everyone][column] = 5;
|
|
|
- players[0].selection[active][row] = yellow;
|
|
|
- players[0].selection[active][column] = 11;
|
|
|
+
|
|
|
// convert userInput into number
|
|
|
// user number to change the boolean on corresponding spot on ScoreSheet
|
|
|
}
|