本文整理汇总了C++中CCard::Suit方法的典型用法代码示例。如果您正苦于以下问题:C++ CCard::Suit方法的具体用法?C++ CCard::Suit怎么用?C++ CCard::Suit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCard
的用法示例。
在下文中一共展示了CCard::Suit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanChow
bool CDeck::CanChow(int const pIdx)
{
if(DumpPile->Empty())
return false;
CCard thrown = DumpPile->Pop();
DumpPile->Push(thrown); //just checking so push again
int Rank = thrown.Rank();
int Suit = thrown.Suit();
int a = PlayerHand[pIdx]->FindCard(Rank + 1, Suit);
int b = PlayerHand[pIdx]->FindCard(Rank + 2, Suit);
int c = PlayerHand[pIdx]->FindCard(Rank - 1, Suit);
int d = PlayerHand[pIdx]->FindCard(Rank - 2, Suit);
int e[3] = {-1, -1, -1}; //cards with same rank
e[0] = PlayerHand[pIdx]->FindMoreSameRank(0, Rank, Suit);
if(e[0] != -1) {
e[1] = PlayerHand[pIdx]->FindMoreSameRank(e[0] + 1, Rank, Suit);
if(e[1] != -1)
e[2] = PlayerHand[pIdx]->FindMoreSameRank(e[1] + 1, Rank, Suit);
}
if(a != -1 && b != -1) {
PlayerHand[pIdx]->SelectCard(a);
PlayerHand[pIdx]->SelectCard(b);
return true;
}
if(a != -1 && c != -1) {
PlayerHand[pIdx]->SelectCard(a);
PlayerHand[pIdx]->SelectCard(c);
return true;
}
if(c != -1 && d != -1) {
PlayerHand[pIdx]->SelectCard(c);
PlayerHand[pIdx]->SelectCard(d);
return true;
}
if(e[0] != -1 && e[1] != -1) {
PlayerHand[pIdx]->SelectCard(e[0]);
PlayerHand[pIdx]->SelectCard(e[1]);
if(e[2] != -1)
PlayerHand[pIdx]->SelectCard(e[2]);
return true;
}
return false;
}