Example #1
0
/*
 * EvaluateType
 *--------------------------------------------------
 *  Pre:	Type of hand is Unknown
 *  Post:	The type of hand is evaluated
 *--------------------------------------------------
 *	Evaluates the hand on each hand type available
 *
 */
void Hand::EvaluateType(){
	
	if(IsStraight() && 	IsFlush()){
		type = STRAIGHT_FLUSH;
	}else if (IsN_Of_A_Kind(FOUR, true)){
		type = FOUR_OF_A_KIND;
	}else if (	IsN_Of_A_Kind(THREE, false) && IsPair(PAIR, false, false)){
		type = FULL_HOUSE;
	}else if (IsFlush()){
		type = FLUSH;
	}else if (IsStraight()){
		type = STRAIGHT;
	}else if (IsN_Of_A_Kind(THREE, true)){
		type = THREE_OF_A_KIND;
	}else if (IsPair(PAIR, true, false)){
		type = TWO_PAIRS;
	}else if (IsPair(PAIR, false, false)){
		type = ONE_PAIR;
	}else{
		type = HIGH_CARD;
	}
}
Example #2
0
int ValuePokerHand( PHAND pHand, PCARD pWild, int bHigh )
{
	int val;
	if( !pHand )
		return 0;
	if( bHigh )
	{
		val = Is5Kind( pHand, pWild );
		// this is a special straight flush (name only?)
		// if( !val ) val = IsRoyalFlush( pHand, pWild );
		if( !val ) val = IsStraightFlush( pHand, pWild );
		if( !val ) val = Is4Kind( pHand, pWild );
		if( !val ) val = IsFullHouse( pHand, pWild );
		if( !val ) val = IsFlush( pHand, pWild );
		if( !val ) val = IsStraight( pHand, pWild );
		if( !val ) val = Is3Kind( pHand, pWild );
		if( !val ) val = Is2Pair( pHand, pWild );
		if( !val ) val = IsPair( pHand, pWild );
		if( !val ) val = HighCard( pHand, pWild );
	}
	else
	{
		val = HighCard( pHand, pWild );
		// this is a special straight flush (name only?)
		// if( !val ) val = IsRoyalFlush( pHand, pWild );
		if( !val ) val = IsStraightFlush( pHand, pWild );
		if( !val ) val = Is4Kind( pHand, pWild );
		if( !val ) val = IsFullHouse( pHand, pWild );
		if( !val ) val = IsFlush( pHand, pWild );
		if( !val ) val = IsStraight( pHand, pWild );
		if( !val ) val = Is3Kind( pHand, pWild );
		if( !val ) val = Is2Pair( pHand, pWild );
		if( !val ) val = IsPair( pHand, pWild );
		if( !val ) val = Is5Kind( pHand, pWild );
	}
   return val;
}
bool Comparer::IsSimilar(Node *n1, Node *n2)
{
	element e1, e2;
	int linedif;
	e1 = n1->value();
	e2 = n2->value();
	if (e1.type != e2.type) return false;
	linedif = e1.lineCount - e2.lineCount;
	if (linedif < 5 && linedif > -5)
	{
		std::vector<Node *> temp1, temp2;
		temp1 = n1->getChildren();
		temp2 = n2->getChildren();
		if (temp1.size() == 0 && temp2.size() == 0) return true;
		if (temp2.size() != 0)
		for (auto node1 : temp1)
		if (IsPair(node1, n2)) return true;

	}
	return false;
}
Example #4
0
bool isList( Ref r ) {
	return IsPair( r ) || IsNil( r );
}
Example #5
0
	bool isPairObject() const { return IsPair( this->ref ); }