/** * Overwrites the current collection with a new set of Double-Six dominoes */ void DominoCollection ::generateDoubleSixSet( void ) { DominoCollection set; for( int i = 6; i > -1; --i ) { for( int j = i; j > -1; --j ) { set.addDomino( Domino( i, j) ); } } *this = set; }
int main() { Vector<Domino> dominos = getVectorOfDominoes(NUM_SIDES); Vector<Domino> toBeSorted = dominos; toBeSorted.remove(0); //remove first element since we start with it in the solution. Vector<Domino> solution; solution.add(Domino(0, 0)); if (formsDominoChain(dominos, toBeSorted, solution)) { cout << "TRUE" << endl; } else { cout << "FALSE" << endl;; } return 0; }
/** * Returns the score (total count) provided by the dominoes in this collection */ int DominoCollection::getTotalScore( void ) { int count = 0; // one point for each trick taken count += dominoes.size() / 4; // ten counters if( countDominoes( Domino( 5, 5 ) ) > 0 ) count += 10; if( countDominoes( Domino( 4, 6 ) ) > 0 ) count += 10; // five counters if( countDominoes( Domino( 0, 5 ) ) > 0 ) count += 5; if( countDominoes( Domino( 1, 4 ) ) > 0 ) count += 5; if( countDominoes( Domino( 2, 3 ) ) > 0 ) count += 5; return count; }