/* * Current count of given side's stones. */ int Board::count(Side side) { return (side == BLACK) ? countBlack() : countWhite(); }
void Bomb::defuseWiresSimple() const { //Read in wire colors in order char module[7]; cout << "(r) Red" << endl << "(w) White" << endl << "(l) Blue" << endl << "(k) Black" << endl << "(y) Yellow" << endl << endl; cout << "Enter the wire colors from top to bottom: "; getString(module); lowerAll(module); //Read out instruction switch (strlen(module)) { case 3: if (countRed(module) == 0) { cout << "Cut the second wire." << endl << endl; break; } if (module[2] == 'w') { cout << "Cut the last wire." << endl << endl; break; } if (countBlue(module) > 1) { cout << "Cut the last blue wire." << endl << endl; break; } cout << "Cut the last wire." << endl << endl; break; case 4: if (countRed(module) > 1 && !serialEven) { cout << "Cut the last red wire." << endl << endl; break; } if (countRed(module) == 0 && module[3] == 'y') { cout << "Cut the first wire." << endl << endl; break; } if (countBlue(module) == 1) { cout << "Cut the first wire." << endl << endl; break; } if (countYellow(module) > 1) { cout << "Cut the last wire."; break; } cout << "Cut the second wire." << endl << endl; break; case 5: if (module[4] == 'k' && !serialEven) { cout << "Cut the fourth wire." << endl << endl; break; } if (countRed(module) == 1 && countYellow(module) > 1) { cout << "Cut the first wire." << endl << endl; break; } if (countBlack(module) == 0) { cout << "Cut the second wire." << endl << endl; break; } cout << "Cut the first wire." << endl << endl; break; case 6: if (countYellow(module) == 0 && !serialEven) { cout << "Cut the third wire." << endl << endl; break; } if (countYellow(module) == 1 && countWhite(module) > 1) { cout << "Cut the fourth wire." << endl << endl; break; } if (countRed(module) == 0) { cout << "Cut the last wire." << endl << endl; break; } cout << "Cut the fourth wire." << endl << endl; break; default: cout << "Incorrect input." << endl << endl; break; } }