1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
bool large_straight( const std::vector<int>& inventory )
{
return inventory == std::vector<int>{0,1,1,1,1,1,0} || // 1, 2, 3, 4, 5
inventory == std::vector<int>{0,0,1,1,1,1,1} ; // 2, 3, 4, 5, 6
}
bool small_straight( std::vector<int> inventory ) // **** pass by value ****
{
for( int& v : inventory ) if( v > 1 ) v = 1 ; // reduce all duplicates.
return // large_straight(inventory) || // uncomment if a large straight is also a small straight
inventory == std::vector<int>{0,1,1,1,1,0,0} || // 1, 2, 3, 4
inventory == std::vector<int>{0,0,1,1,1,1,0} || // 2, 3, 4, 5
inventory == std::vector<int>{0,0,0,1,1,1,1} ; // 3, 4, 5, 6
}
|