本文整理汇总了C++中Card::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ Card::GetID方法的具体用法?C++ Card::GetID怎么用?C++ Card::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::GetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitKB
void KnowledgeBase::InitKB( Set<Card> oSet )
{
oSet.Begin();
while( oSet.HasNext() )
{
Card* pCard = oSet.GetNext();
if ( i_KitID == ( pCard->GetID() & (SUIT::SUIT_MASK | KIT::KIT_MASK) ) )
{
SetState(i_ThisPlayerID, pCard->GetID(), STATE::HAVE);
for(int i=0; i<NUM_PLAYERS; ++i)
{
if ( i != i_ThisPlayerID )
{
SetState(i, pCard->GetID(), STATE::DONT_HAVE);
}
}
}
}
// There cannot be NOT_CHECKED states in this player's positions, turn them to DONT_HAVE
for (int i = 0; i < NUM_CARDS; ++i)
{
if ( GetState(i_ThisPlayerID, GetCardIDFromIndex(i)) == STATE::NOT_CHECKED )
{
SetState(i_ThisPlayerID, GetCardIDFromIndex(i), STATE::DONT_HAVE);
}
}
}
示例2:
// Assumes the input set only contains cards of a single kit
Set<Card>* DifferentialFilter::Enter( Set<Card>* pInput )
{
pInput->Begin();
if ( pInput->HasNext() )
{
Card* pCard = pInput->GetNext();
int iSuit = pCard->GetSuit();
int iKit = pCard->GetKit();
Set<Card>* pCompleteKit = Deck::GetInstace()->GetKit( iSuit | iKit );
Set<Card>* pResultSet = new Set<Card>();
for (pCompleteKit->Begin(); pCompleteKit->HasNext();)
{
Card* pResultCard = pCompleteKit->GetNext();
bool bRequired = true;
for (pInput->Begin(); pInput->HasNext();)
{
Card* pInputCard = pInput->GetNext();
if ( pResultCard->GetID() == pInputCard->GetID() )
{
bRequired = false;
break;
}
}
if (bRequired)
{
pResultSet->PushBack(pResultCard);
}
}
return pResultSet;
}
return NULL;
}