This commit is contained in:
2024-06-22 16:30:20 +08:00
parent e4e00e8192
commit e7c056f9ba
6 changed files with 12 additions and 14 deletions

View File

@@ -18,12 +18,12 @@ inline void DealCards(int N, SqList<int>*& PA, SqList<int>*& PB)
{
if (CardPile[num] != 0) // 如果该数对应面值的牌未发完
{
if (i % 2 == 0) // 发给PA
if (i % 2 == 0) // 如果发牌次数(i+1)为奇数,则发给PA
{
InsertElem_i(*PA, j++, num + 1);
CardPile[num]--;
}
else // 发给PB
else // 否则发给PB
{
InsertElem_i(*PB, k++, num + 1);
CardPile[num]--;
@@ -49,10 +49,4 @@ inline int FindElem(SqStack<int>& S, int e)
inline bool IsPlayerA(int i)
{
return i % 2 == 1;
}
// 返回栈元素数量
inline int StackSize(SqStack<int>& S)
{
return S.top + 1;
}