#include "game.h" Game::Game() { // initialize the number of columns that each "color" will contain lastColumnIndex = CHECKBOXES - 1; // set up lockOut for(int i = 0; i pointsGuide = {0,1,3,6,10,15,21,28,36,45,55,66,78}; // check players' card for marked boxes for(int i = 0;i index || 0 < index){fprintf(stdout,"Player[%d] %s index is too high or too low X\n", player, players[player].savedName);} // if color is not valid throw an error players[0].cumulativeOlok.isColor(red); if(color){fprintf(stdout,"Player[%d] %s invalid color selected X\n", player, players[player].savedName);} #endif // 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...) // convert userInput into number // user number to change the boolean on corresponding spot on ScoreSheet } /* add a checkbox to a specified players scoresheet user specifies player's: XXXX, the color, and index of the checkbox on the colored row * dont know what XXXX is yet - but it will be used to find correct player * * * * the white die and color combo must match the corresponding RowColor and index * */ /* * all players can do white die combination, active player can do a colored + white die combination. * * ## Things we need to know ## * sum of both white die * 8 sums of each of the white die and all of the colored die * who is the active player for this turn * * ## How to do ## * on a given turn, sum the white die and sum each of the white die and all of the colored die * check to see if each players' requested move is valid * does the player's requested move match the sum of the white die "satisfies all players can do white die combination" * if the active player, check both white die and the color die they requested for move * TODO: deal with subtley of active player not being able to re-use dice * record if active player took at least a white dice move, a colored die move, or both * if it is valid, add it to player card * if it is not valid, return an error to player */ void Game::addX(int player, int color, int index) { /* TODO: check that index and color match rolled die * ## Rule Check ## * if index is not the sum of two dice throw an error * if index is a sum AND color is correct allow it */ // player can add an x to olok in last column if there are 5 x if(lastColumnIndex == index) { if(LOCKOUT_QUALIFIER >= players[player].cumulativeOlok.getXCount(color)) { players[player].currentTurnOlok.addX(color, index); } else{fprintf(stdout, "Player[%d] %s tried to check off column 12 without minimum X\n", player, players[player].savedName);} } // player must add an x to olok from left to right if(players[player].cumulativeOlok.getLastIndex(color) > index) { fprintf(stdout,"Player[%d] %s not following left to right rule X\n", player, players[player].savedName); } else{players[player].currentTurnOlok.addX(color, index);} }