日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

挖坑机器人算法

發布時間:2024/4/11 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 挖坑机器人算法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#ifndef ANDROID_USER_ITEM_SINK_HEAD_FILE
#define ANDROID_USER_ITEM_SINK_HEAD_FILE


#pragma once


#include "Stdafx.h"
#include "GameLogic.h"


//


//機器人類
class CAndroidUserItemSink : public IAndroidUserItemSink
{
//游戲變量
protected:
WORD m_wBankerUser; //莊家用戶
BYTE m_cbCurrentLandScore; //已叫分數
WORD m_wOutCardUser; //出牌玩家


//撲克變量
protected:
BYTE m_cbTurnCardCount; //出牌數目
BYTE m_cbTurnCardData[MAX_COUNT]; //出牌列表


//手上撲克
protected:
BYTE m_cbHandCardData[MAX_COUNT]; //手上撲克
BYTE m_cbHandCardCount[GAME_PLAYER]; //撲克數目


//搜索結果
protected:
tagSearchCardResult m_OutCardResult; //搜索結果


//歷史撲克
protected:


//控件變量
protected:
CGameLogic m_GameLogic; //游戲邏輯
IAndroidUserItem * m_pIAndroidUserItem; //用戶接口


//函數定義
public:
//構造函數
CAndroidUserItemSink();
//析構函數
virtual ~CAndroidUserItemSink();


//基礎接口
public:
//釋放對象
virtual VOID Release() { delete this; }
//接口查詢
virtual VOID * QueryInterface(REFGUID Guid, DWORD dwQueryVer);


//控制接口
public:
//初始接口
virtual bool Initialization(IUnknownEx * pIUnknownEx);
//重置接口
virtual bool RepositionSink();


//游戲事件
public:
//時間消息
virtual bool OnEventTimer(UINT nTimerID);
//游戲消息
virtual bool OnEventGameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize);
//游戲消息
virtual bool OnEventFrameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize);
//場景消息
virtual bool OnEventSceneMessage(BYTE cbGameStatus, bool bLookonOther, VOID * pData, WORD wDataSize);


//用戶事件
public:
//用戶進入
virtual VOID OnEventUserEnter(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser);
//用戶離開
virtual VOID OnEventUserLeave(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser);
//用戶積分
virtual VOID OnEventUserScore(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser);
//用戶狀態
virtual VOID OnEventUserStatus(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser);
//用戶段位
virtual VOID OnEventUserSegment(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser);


//消息處理
protected:
//游戲開始
bool OnSubGameStart(VOID * pData, WORD wDataSize);
//用戶叫分
bool OnSubCallScore(VOID * pData, WORD wDataSize);
//莊家信息
bool OnSubBankerInfo(VOID * pData, WORD wDataSize);
//用戶出牌
bool OnSubOutCard(VOID * pData, WORD wDataSize);
//用戶放棄
bool OnSubPassCard(VOID * pData, WORD wDataSize);
//游戲結束
bool OnSubGameEnd(VOID * pData, WORD wDataSize);
public:
//思考出牌
bool AndroidThinkToOutCard(void);
};


//


#endif

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#include "Stdafx.h"
#include "AndroidUserItemSink.h"
#include "ClogFile.h"


//
//輔助時間
#define TIME_LESS 2//最少時間
#define TIME_DISPATCH 5//發牌時間


//游戲時間
#define TIME_OUT_CARD 2//出牌時間
#define TIME_START_GAME 5//開始時間
#define TIME_CALL_SCORE 3//叫分時間


//游戲時間
#define IDI_OUT_CARD (0)//出牌定時器
#define IDI_START_GAME (1)//開始定時器
#define IDI_CALL_SCORE (2)//叫分定時器
#define IDI_AI_TALK (3)//說話定時器
//


//構造函數
CAndroidUserItemSink::CAndroidUserItemSink()
{
//游戲變量
m_wBankerUser=INVALID_CHAIR;
m_cbCurrentLandScore=0;
m_wOutCardUser=INVALID_CHAIR;


//撲克變量
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));


//手上撲克
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));
ZeroMemory(&m_OutCardResult,sizeof(m_OutCardResult));


//接口變量
m_pIAndroidUserItem=NULL;;


//隨機時間
srand( (unsigned)time( NULL ) );


return;
}


//析構函數
CAndroidUserItemSink::~CAndroidUserItemSink()
{
}


//接口查詢
VOID * CAndroidUserItemSink::QueryInterface(REFGUID Guid, DWORD dwQueryVer)
{
QUERYINTERFACE(IAndroidUserItemSink,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IAndroidUserItemSink,Guid,dwQueryVer);
return NULL;
}


//初始接口
bool CAndroidUserItemSink::Initialization(IUnknownEx * pIUnknownEx)
{
//查詢接口
m_pIAndroidUserItem=QUERY_OBJECT_PTR_INTERFACE(pIUnknownEx,IAndroidUserItem);
if (m_pIAndroidUserItem==NULL) return false;


return true;
}


//重置接口
bool CAndroidUserItemSink::RepositionSink()
{
//游戲變量
m_wBankerUser=INVALID_CHAIR;


//撲克變量
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));


//手上撲克
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));


return true;
}


//時間消息
bool CAndroidUserItemSink::OnEventTimer(UINT nTimerID)
{
switch (nTimerID)
{
case IDI_START_GAME://開始游戲
{
//開始判斷
m_pIAndroidUserItem->SendUserReady(NULL,0);


//將會說話
int nElapse = rand()%50 + 5;
int ifWillTalk = rand()%3;
if (ifWillTalk == 0)
{
m_pIAndroidUserItem->SetGameTimer(IDI_AI_TALK,nElapse);
}


return true;
}
case IDI_CALL_SCORE://用戶叫分
{
//構造變量
CMD_C_CallScore CallScore;
ZeroMemory(&CallScore,sizeof(CallScore));


//設置變量
CallScore.cbCallScore=m_GameLogic.LandScore(m_pIAndroidUserItem->GetChairID(), m_cbCurrentLandScore);


//發送數據
m_pIAndroidUserItem->SendSocketData(SUB_C_CALL_SCORE,&CallScore,sizeof(CallScore));


return true;
}
case IDI_OUT_CARD://用戶出牌
{
//結果判斷
if (m_OutCardResult.cbCardCount>0)
{
//構造變量
CMD_C_OutCard OutCard;
ZeroMemory(&OutCard, sizeof(OutCard));


//設置變量
OutCard.cbCardCount=m_OutCardResult.cbCardCount;
CopyMemory(OutCard.cbCardData, m_OutCardResult.cbResultCard, m_OutCardResult.cbCardCount*sizeof(BYTE));


//發送數據
WORD wHeadSize=sizeof(OutCard)-sizeof(OutCard.cbCardData);
m_pIAndroidUserItem->SendSocketData(SUB_C_OUT_CARD, &OutCard, wHeadSize+OutCard.cbCardCount*sizeof(BYTE));
}
else
{
//放棄出牌
m_pIAndroidUserItem->SendSocketData(SUB_C_PASS_CARD);
}


//重置結果
ZeroMemory(&m_OutCardResult,sizeof(m_OutCardResult));


return true;
}
case IDI_AI_TALK://機器人說話
{
WORD wChairId = m_pIAndroidUserItem->GetChairID();
if (wChairId != INVALID_CHAIR)
{
CMD_C_ReminderUserCard info;
info.nChairID = wChairId;
info.nExpressIndex = 3 + rand()%7;


m_pIAndroidUserItem->SendSocketData(SUB_C_REMINDER_USER_CARD,&info,sizeof(info));
}
return true;
}
}


return false;
}


//游戲消息
bool CAndroidUserItemSink::OnEventGameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize)
{
switch (wSubCmdID)
{
case SUB_S_GAME_START://游戲開始
{
return OnSubGameStart(pData,wDataSize);
}
case SUB_S_CALL_SCORE://用戶叫分
{
return OnSubCallScore(pData,wDataSize);
}
case SUB_S_BANKER_INFO://莊家信息
{
return OnSubBankerInfo(pData,wDataSize);
}
case SUB_S_OUT_CARD://用戶出牌
{
return OnSubOutCard(pData,wDataSize);
}
case SUB_S_PASS_CARD://用戶放棄
{
return OnSubPassCard(pData,wDataSize);
}
case SUB_S_GAME_CONCLUDE://游戲結束
{
return OnSubGameEnd(pData,wDataSize);
}
}


return true;
}


//游戲消息
bool CAndroidUserItemSink::OnEventFrameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize)
{
return true;
}


//場景消息
bool CAndroidUserItemSink::OnEventSceneMessage(BYTE cbGameStatus, bool bLookonOther, VOID * pData, WORD wDataSize)
{
switch (cbGameStatus)
{
case GAME_SCENE_FREE://空閑狀態
{
//效驗數據
ASSERT(wDataSize==sizeof(CMD_S_StatusFree));
if (wDataSize!=sizeof(CMD_S_StatusFree)) return false;


//變量定義
CMD_S_StatusFree * pStatusFree=(CMD_S_StatusFree *)pData;
IServerUserItem * pIServerUserItem=m_pIAndroidUserItem->GetMeUserItem();


//玩家設置
if (pIServerUserItem->GetUserStatus()!=US_READY)
{
UINT nElapse=rand()%TIME_START_GAME+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_START_GAME,nElapse);
}


return true;
}
case GAME_SCENE_CALL://叫分狀態
{
//效驗數據
if (wDataSize!=sizeof(CMD_S_StatusCall)) return false;
CMD_S_StatusCall * pStatusCall=(CMD_S_StatusCall *)pData;


//撲克數據
for (WORD i=0;i<GAME_PLAYER;i++) m_cbHandCardCount[i]=NORMAL_COUNT;
CopyMemory(m_cbHandCardData,pStatusCall->cbHandCardData,sizeof(BYTE)*NORMAL_COUNT);


//叫分設置
if (m_pIAndroidUserItem->GetChairID()==pStatusCall->wCurrentUser)
{
UINT nElapse=rand()%TIME_CALL_SCORE+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_CALL_SCORE,nElapse+TIME_DISPATCH);
}


return true;
}
case GAME_SCENE_PLAY://游戲狀態
{
//效驗數據
if (wDataSize!=sizeof(CMD_S_StatusPlay)) return false;
CMD_S_StatusPlay * pStatusPlay=(CMD_S_StatusPlay *)pData;


//出牌變量
m_cbTurnCardCount=pStatusPlay->cbTurnCardCount;
CopyMemory(m_cbTurnCardData,pStatusPlay->cbTurnCardData,m_cbTurnCardCount*sizeof(BYTE));


//撲克數據
WORD wMeChairID=m_pIAndroidUserItem->GetChairID();
CopyMemory(m_cbHandCardCount,pStatusPlay->cbHandCardCount,sizeof(m_cbHandCardCount));
CopyMemory(m_cbHandCardData,pStatusPlay->cbHandCardData,sizeof(BYTE)*m_cbHandCardCount[wMeChairID]);


//玩家設置
if (pStatusPlay->wCurrentUser==m_pIAndroidUserItem->GetChairID())
{
UINT nElapse=rand()%TIME_OUT_CARD+TIME_LESS+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_OUT_CARD,nElapse);
}


return true;
}
case SUB_GF_USER_CHAT://聊天消息
{
//跟著說話
int nElapse = rand()%3 + 1;
int ifWillTalk = rand()%7;
if (ifWillTalk == 0)
{
m_pIAndroidUserItem->SetGameTimer(IDI_AI_TALK, nElapse);
}
return true;
}
}


//錯誤斷言
ASSERT(FALSE);


return false;
}


//用戶進入
VOID CAndroidUserItemSink::OnEventUserEnter(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser)
{
return;
}


//用戶離開
VOID CAndroidUserItemSink::OnEventUserLeave(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser)
{
return;
}


//用戶積分
VOID CAndroidUserItemSink::OnEventUserScore(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser)
{
return;
}


//用戶狀態
VOID CAndroidUserItemSink::OnEventUserStatus(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser)
{
return;
}


//用戶段位
VOID CAndroidUserItemSink::OnEventUserSegment(IAndroidUserItem * pIAndroidUserItem, bool bLookonUser)
{
return;
}


//游戲開始
bool CAndroidUserItemSink::OnSubGameStart(VOID * pData, WORD wDataSize)
{
//效驗參數
ASSERT(wDataSize==sizeof(CMD_S_AndroidCard));
if (wDataSize!=sizeof(CMD_S_AndroidCard)) return false;


//變量定義
CMD_S_AndroidCard * pAndroidCard=(CMD_S_AndroidCard *)pData;


//設置狀態
m_pIAndroidUserItem->SetGameStatus(GAME_SCENE_CALL);
m_cbCurrentLandScore = 0 ;


//撲克變量
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));
ZeroMemory(m_GameLogic.m_cbAllCardData,sizeof(m_GameLogic.m_cbAllCardData));
ZeroMemory(m_GameLogic.m_cbUserCardCount,sizeof(m_GameLogic.m_cbUserCardCount));


//手上撲克
WORD wMeChairID=m_pIAndroidUserItem->GetChairID();
for (WORD i=0;i<GAME_PLAYER;i++) m_cbHandCardCount[i]=NORMAL_COUNT;


for(WORD wChairID=0; wChairID<GAME_PLAYER; ++wChairID)
{
if(wChairID==wMeChairID)
{
CopyMemory(m_cbHandCardData,pAndroidCard->cbHandCard[wChairID],sizeof(BYTE)*NORMAL_COUNT);
}
m_GameLogic.SetUserCard(wChairID, pAndroidCard->cbHandCard[wChairID], NORMAL_COUNT) ;
}


//排列撲克
m_GameLogic.SortCardList(m_cbHandCardData,m_cbHandCardCount[wMeChairID],ST_ORDER);


//首出玩家
if (m_pIAndroidUserItem->GetChairID()==pAndroidCard->wCurrentUser)
{
UINT nElapse=rand()%TIME_CALL_SCORE+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_CALL_SCORE,nElapse+TIME_DISPATCH);
}


return true;
}


//用戶叫分
bool CAndroidUserItemSink::OnSubCallScore(VOID * pData, WORD wDataSize)
{
//效驗參數
ASSERT(wDataSize==sizeof(CMD_S_CallScore));
if (wDataSize!=sizeof(CMD_S_CallScore)) return false;


//變量定義
CMD_S_CallScore * pCallScore=(CMD_S_CallScore *)pData;
m_cbCurrentLandScore = pCallScore->cbCurrentScore ;


//用戶處理
if (m_pIAndroidUserItem->GetChairID()==pCallScore->wCurrentUser)
{
UINT nElapse=rand()%TIME_CALL_SCORE+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_CALL_SCORE,nElapse);
}


return true;
}


//莊家信息
bool CAndroidUserItemSink::OnSubBankerInfo(VOID * pData, WORD wDataSize)
{
//效驗參數
ASSERT(wDataSize==sizeof(CMD_S_BankerInfo));
if (wDataSize!=sizeof(CMD_S_BankerInfo)) return false;


//變量定義
CMD_S_BankerInfo * pBankerInfo=(CMD_S_BankerInfo *)pData;


//設置狀態
m_pIAndroidUserItem->SetGameStatus(GAME_SCENE_PLAY);


//設置變量
m_wBankerUser=pBankerInfo->wBankerUser;
m_cbHandCardCount[m_wBankerUser]+=CountArray(pBankerInfo->cbBankerCard);


//我是莊家
if (pBankerInfo->wBankerUser==m_pIAndroidUserItem->GetChairID())
{
//設置撲克
CopyMemory(&m_cbHandCardData[NORMAL_COUNT],pBankerInfo->cbBankerCard,sizeof(pBankerInfo->cbBankerCard));


//排列撲克
WORD wMeChairID=m_pIAndroidUserItem->GetChairID();
m_GameLogic.SortCardList(m_cbHandCardData,m_cbHandCardCount[wMeChairID],ST_ORDER);
}


//設置底牌
m_GameLogic.SetBackCard(pBankerInfo->wBankerUser, pBankerInfo->cbBankerCard, DIPAI_CARD_COUNT) ;
m_GameLogic.SetBanker(pBankerInfo->wBankerUser) ;

//玩家設置
if (pBankerInfo->wCurrentUser==m_pIAndroidUserItem->GetChairID())
{
AndroidThinkToOutCard();
}
return true;
}


//用戶出牌
bool CAndroidUserItemSink::OnSubOutCard(VOID * pData, WORD wDataSize)
{
//變量定義
CMD_S_OutCard * pOutCard=(CMD_S_OutCard *)pData;
WORD wHeadSize=sizeof(CMD_S_OutCard)-sizeof(pOutCard->cbCardData);


//效驗數據
ASSERT((wDataSize>=wHeadSize)&&(wDataSize==(wHeadSize+pOutCard->cbCardCount*sizeof(BYTE))));
if ((wDataSize<wHeadSize)||(wDataSize!=(wHeadSize+pOutCard->cbCardCount*sizeof(BYTE)))) return false;


//出牌變量
if (pOutCard->wCurrentUser==pOutCard->wOutCardUser)
{
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
}
else
{
m_cbTurnCardCount=pOutCard->cbCardCount;
CopyMemory(m_cbTurnCardData,pOutCard->cbCardData,pOutCard->cbCardCount*sizeof(BYTE));
m_wOutCardUser = pOutCard->wOutCardUser ;
}


//Logic層變量
m_GameLogic.RemoveUserCardData(pOutCard->wOutCardUser, pOutCard->cbCardData, pOutCard->cbCardCount) ;


//Sink層變量
if (pOutCard->wOutCardUser == m_pIAndroidUserItem->GetChairID())
{
m_GameLogic.RemoveCard(pOutCard->cbCardData,pOutCard->cbCardCount,m_cbHandCardData,m_cbHandCardCount[m_pIAndroidUserItem->GetChairID()]);
}
m_cbHandCardCount[pOutCard->wOutCardUser] -= pOutCard->cbCardCount;


//輪到玩家
if (m_pIAndroidUserItem->GetChairID()==pOutCard->wCurrentUser)
{
AndroidThinkToOutCard();
}
return true;
}


//用戶放棄
bool CAndroidUserItemSink::OnSubPassCard(VOID * pData, WORD wDataSize)
{
//效驗數據
ASSERT(wDataSize==sizeof(CMD_S_PassCard));
if (wDataSize!=sizeof(CMD_S_PassCard)) return false;


//變量定義
CMD_S_PassCard * pPassCard=(CMD_S_PassCard *)pData;


//一輪判斷
if (pPassCard->cbTurnOver==TRUE)
{
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
}


//玩家設置
if (m_pIAndroidUserItem->GetChairID()==pPassCard->wCurrentUser)
{
AndroidThinkToOutCard();
}


return true;
}


//游戲結束
bool CAndroidUserItemSink::OnSubGameEnd(VOID * pData, WORD wDataSize)
{
//效驗數據
ASSERT(wDataSize==sizeof(CMD_S_GameConclude));
if (wDataSize!=sizeof(CMD_S_GameConclude)) return false;


//變量定義
CMD_S_GameConclude * pGameEnd=(CMD_S_GameConclude *)pData;


//設置狀態
m_pIAndroidUserItem->SetGameStatus(GAME_SCENE_FREE);


//設置變量
m_cbTurnCardCount=0;
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));


//刪除時間
m_pIAndroidUserItem->KillGameTimer(IDI_OUT_CARD);
m_pIAndroidUserItem->KillGameTimer(IDI_CALL_SCORE);
m_pIAndroidUserItem->KillGameTimer(IDI_AI_TALK);


//開始設置
UINT nElapse=rand()%TIME_START_GAME+TIME_LESS;
m_pIAndroidUserItem->SetGameTimer(IDI_START_GAME,nElapse);


return true;
}


//


//思考出牌
bool CAndroidUserItemSink::AndroidThinkToOutCard(void)
{
try
{
WORD wMeChairID=m_pIAndroidUserItem->GetChairID();
m_GameLogic.SearchOutCard(m_cbHandCardData,m_cbHandCardCount[wMeChairID],m_cbTurnCardData,m_cbTurnCardCount, m_wOutCardUser, m_pIAndroidUserItem->GetChairID(), m_OutCardResult);
m_GameLogic.SortCardList(m_OutCardResult.cbResultCard,m_OutCardResult.cbCardCount,ST_ORDER);
}
catch(...)
{
ZeroMemory(m_OutCardResult.cbResultCard, sizeof(m_OutCardResult.cbResultCard)) ;
m_OutCardResult.cbCardCount = 0 ;
}


//牌型合法
if(m_OutCardResult.cbCardCount>0 )
{
if (m_cbTurnCardCount == 0 && m_GameLogic.GetCardType(m_OutCardResult.cbResultCard, m_OutCardResult.cbCardCount) == CT_ERROR)
{
ASSERT(false) ;
ZeroMemory(&m_OutCardResult, sizeof(m_OutCardResult)) ;
}
}


//先出牌不能為空
if(m_cbTurnCardCount == 0)
{
if (m_OutCardResult.cbCardCount == 0)
{
WORD wMeChairID = m_pIAndroidUserItem->GetChairID();


//最小一張
m_OutCardResult.cbCardCount = 1 ;
m_OutCardResult.cbResultCard[0] = m_cbHandCardData[m_cbHandCardCount[wMeChairID]-1] ;
}
}
else
{
if(!m_GameLogic.CompareCard(m_cbTurnCardData, m_OutCardResult.cbResultCard, m_cbTurnCardCount, m_OutCardResult.cbCardCount))
{
ZeroMemory(&m_OutCardResult, sizeof(m_OutCardResult)) ;
}
}


//出牌事件
UINT nElapse=rand()%TIME_OUT_CARD + TIME_LESS;


//特殊情況
if (m_cbTurnCardCount==0 || m_cbHandCardCount[m_pIAndroidUserItem->GetChairID()]<=3) nElapse=2;
m_pIAndroidUserItem->SetGameTimer(IDI_OUT_CARD, nElapse);


return true;
}

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#ifndef GAME_LOGIC_HEAD_FILE
#define GAME_LOGIC_HEAD_FILE


#pragma once


#include "Stdafx.h"


//


//排序類型
#define ST_ORDER 0//大小排序
#define ST_COUNT 1//數目排序
#define ST_CUSTOM 2//自定排序


//


//分析結構
struct tagAnalyseResult
{
BYTE cbBlockCount[4];//撲克數目
BYTE cbCardData[4][MAX_COUNT];//撲克數據
};


//分布信息
struct tagDistributing
{
BYTE cbCardCount;//撲克數目
BYTE cbDistributing[15][6];//分布信息
};


#define MAX_TYPE_COUNT 254
struct tagOutCardTypeResult?
{
BYTE cbCardType;//撲克類型
BYTE cbCardTypeCount;//牌型數目
BYTE cbEachHandCardCount[MAX_TYPE_COUNT];//每手個數
BYTE cbCardData[MAX_TYPE_COUNT][MAX_COUNT];//撲克數據
};


//搜索結果
struct tagSearchCardResult
{
BYTE cbCardCount;//撲克數目
BYTE cbResultCard[MAX_COUNT];//結果撲克
};


//牌型分布
struct CardsDistribution
{
//牌型數量
BYTE cbThreeLineCardsCount[4];//儲存三順
BYTE cbDoubleLineCardsCount[4];//儲存雙順
BYTE cbSingleLineCardsCount[7];//儲存單順
BYTE cbFourCardsCount;//儲存四牌
BYTE cbThreeCardsCount;//儲存三牌
BYTE cbDoubleCardsCount;//儲存對牌
BYTE cbSingleCardsCount;//儲存單牌


//牌的數值
BYTE cbThreeLineCards[4][10];//儲存三順
BYTE cbDoubleLineCards[4][10];//儲存雙順
BYTE cbSingleLineCards[7][10];//儲存單順
BYTE cbFourCards[5][4];//儲存四牌
BYTE cbThreeCards[7][3];//儲存三牌
BYTE cbDoubleCards[13][2];//儲存對牌
BYTE cbSingleCards[13];//儲存單牌


//四順暫不考慮
};




//


//游戲邏輯類
class CGameLogic
{
//變量定義
protected:
static const BYTEm_cbCardData[FULL_COUNT]; //撲克數據


//AI變量
public:


BYTE m_cbAllCardData[GAME_PLAYER][MAX_COUNT];//所有撲克
BYTE m_cbUserCardCount[GAME_PLAYER];//撲克數目
WORD m_wBankerUser;//地主玩家


//函數定義
public:
//構造函數
CGameLogic();
//析構函數
virtual ~CGameLogic();


//類型函數
public:
//獲取類型
BYTE GetCardType(const BYTE cbCardData[], BYTE cbCardCount);
//獲取數值
BYTE GetCardValue(BYTE cbCardData) { return cbCardData&MASK_VALUE; }
//獲取花色
BYTE GetCardColor(BYTE cbCardData) { return cbCardData&MASK_COLOR; }


//控制函數
public:
//排列撲克
VOID SortCardList(BYTE cbCardData[], BYTE cbCardCount, BYTE cbSortType);
//刪除撲克
bool RemoveCard(const BYTE cbRemoveCard[], BYTE cbRemoveCount, BYTE cbCardData[], BYTE cbCardCount);


//邏輯函數
public:
//邏輯數值
BYTE GetCardLogicValue(BYTE cbCardData);
//對比撲克
bool CompareCard(const BYTE cbFirstCard[], const BYTE cbNextCard[], BYTE cbFirstCount, BYTE cbNextCount);


//內部函數
public:
//分析撲克
VOID AnalysebCardData(const BYTE cbCardData[], BYTE cbCardCount, tagAnalyseResult & AnalyseResult);


//設置函數
public:
//設置撲克
VOID SetUserCard(WORD wChairID, BYTE cbCardData[], BYTE cbCardCount) ;
//設置底牌
VOID SetBackCard(WORD wChairID, BYTE cbBackCardData[], BYTE cbCardCount) ;
//設置莊家
VOID SetBanker(WORD wBanker) ;
//刪除撲克
VOID RemoveUserCardData(WORD wChairID, BYTE cbRemoveCardData[], BYTE cbRemoveCardCount) ;


//出牌函數
public:
//出牌搜索
bool SearchOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, WORD wOutCardUser, WORD wMeChairID, tagSearchCardResult & m_OutCardResult);


//地主出牌(先出牌)
VOID BankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, tagSearchCardResult & m_OutCardResult) ;
//地主出牌(后出牌)
VOID BankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult) ;
//地主上家(先出牌)
VOID UpsideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wMeChairID,tagSearchCardResult & m_OutCardResult) ;
//地主上家(后出牌)
VOID UpsideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, ?const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult) ;
//地主下家(先出牌)
VOID UndersideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wMeChairID,tagSearchCardResult & m_OutCardResult) ;
//地主下家(后出牌)
VOID UndersideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult) ;

//智能邏輯
public:
//分析拍的數據
//只分析對子
void AnalyseDoubleCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbDoubleCards);
//只分析三牌
void AnalyseThreeCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbThreeCards);
//只分析四牌
void AnalyseFourCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbFourCards);
//分析我的牌
bool AnalyseMyCards(const BYTE cbCardData[], BYTE cbCardCount, CardsDistribution &myCardsDistribution);
//牌值評估
int EvaluateUserCards(const BYTE cbCardData[], BYTE cbCardCount);

//獲得最小牌
BYTE GetLestCard(const BYTE cbCardData[], BYTE cbCardCount);
//獲得最小雙牌
bool GetLestDoubleCards(const BYTE cbHandCardData[], BYTE cbHandCardCount, BYTE cbLestDoubleCards[2]);
//最大牌值
BYTE GetAllUserLargestCardLogicValue(void);

//叫分判斷
BYTE LandScore(WORD wMeChairID, BYTE cbCurrentLandScore) ;
//連牌搜索
bool SearchLineCardType(const BYTE cbHandCardData[], BYTE cbHandCardCount, BYTE cbLestCard, BYTE cbBlockCount, BYTE cbLineCount, tagSearchCardResult * pSearchCardResult);


//考慮自己
bool OutCardAccordingToMyCards(const BYTE cbHandCardData[], BYTE cbHandCardCount, tagSearchCardResult & m_OutCardResult);
//能壓就壓
bool OutCardForced(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult);
//強制拐牌
void OutBigCardsFirst(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, BYTE cbMeChairID, tagSearchCardResult & m_OutCardResult);
//莊家是否就剩一張牌了
bool IsBankerOnlyHaveOneCard(void);
//我已經能贏了
bool ICanWin(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult);
};


//


#endif

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

#include "StdAfx.h"
#include "GameLogic.h"
#include "ClogFile.h"


//撲克數據
const BYTE CGameLogic::m_cbCardData[FULL_COUNT]=
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D, //方塊 A - K
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, //梅花 A - K
0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D, //紅桃 A - K
0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D, //黑桃 A - K
};


//構造函數
CGameLogic::CGameLogic()
{
}


//析構函數
CGameLogic::~CGameLogic()
{
}


//設置撲克
VOID CGameLogic::SetUserCard(WORD wChairID, BYTE cbCardData[], BYTE cbCardCount)
{
CopyMemory(m_cbAllCardData[wChairID], cbCardData, cbCardCount*sizeof(BYTE)) ;
m_cbUserCardCount[wChairID] = cbCardCount ;


//排列撲克
SortCardList(m_cbAllCardData[wChairID], cbCardCount, ST_ORDER) ;
}


//設置底牌
VOID CGameLogic::SetBackCard(WORD wChairID, BYTE cbBackCardData[], BYTE cbCardCount)
{
BYTE cbTmpCount = m_cbUserCardCount[wChairID] ;
CopyMemory(m_cbAllCardData[wChairID]+cbTmpCount, cbBackCardData, cbCardCount*sizeof(BYTE)) ;
m_cbUserCardCount[wChairID] += cbCardCount ;


//排列撲克
SortCardList(m_cbAllCardData[wChairID], m_cbUserCardCount[wChairID], ST_ORDER) ;
}


//設置莊家
VOID CGameLogic::SetBanker(WORD wBanker)?
{
m_wBankerUser = wBanker ;
}


//刪除撲克
VOID CGameLogic::RemoveUserCardData(WORD wChairID, BYTE cbRemoveCardData[], BYTE cbRemoveCardCount)?
{
bool bSuccess = RemoveCard(cbRemoveCardData, cbRemoveCardCount, m_cbAllCardData[wChairID], m_cbUserCardCount[wChairID]) ;
ASSERT(bSuccess) ;
m_cbUserCardCount[wChairID] -= cbRemoveCardCount ;


}


//獲取類型
BYTE CGameLogic::GetCardType(const BYTE cbCardData[], BYTE cbCardCount)
{
//簡單牌型
switch (cbCardCount)
{
case 0: //空牌
{
return CT_ERROR;
}
case 1: //單牌
{
return CT_SINGLE;
}
case 2: //對牌
{
if (GetCardLogicValue(cbCardData[0])==GetCardLogicValue(cbCardData[1])) return CT_DOUBLE;
return CT_ERROR;
}
}


//分析撲克
tagAnalyseResult AnalyseResult;
AnalysebCardData(cbCardData,cbCardCount,AnalyseResult);


//四牌判斷
if (AnalyseResult.cbBlockCount[3]>0)
{
//牌型判斷
if ((AnalyseResult.cbBlockCount[3]==1)&&(cbCardCount==4)) return CT_BOMB_CARD;


//連牌判斷
if (AnalyseResult.cbBlockCount[3]>2)
{
//變量定義
BYTE cbCardData=AnalyseResult.cbCardData[3][0];
BYTE cbFirstLogicValue=GetCardLogicValue(cbCardData);


//錯誤過慮
if (cbFirstLogicValue>=14) return CT_ERROR;


//連牌判斷
for (BYTE i=1;i<AnalyseResult.cbBlockCount[3];i++)
{
BYTE cbCardData=AnalyseResult.cbCardData[3][i*4];
if (cbFirstLogicValue!=(GetCardLogicValue(cbCardData)+i)) return CT_ERROR;
}
if (AnalyseResult.cbBlockCount[3]*4 == cbCardCount)
{
return CT_THREE_LINE;
}
}
return CT_ERROR;
}


//三牌判斷
if (AnalyseResult.cbBlockCount[2]>0)
{
//連牌判斷
if (AnalyseResult.cbBlockCount[2]>2)
{
//變量定義
BYTE cbCardData=AnalyseResult.cbCardData[2][0];
BYTE cbFirstLogicValue=GetCardLogicValue(cbCardData);


//錯誤過慮
if (cbFirstLogicValue>=14) return CT_ERROR;


//連牌判斷
for (BYTE i=1;i<AnalyseResult.cbBlockCount[2];i++)
{
BYTE cbCardData=AnalyseResult.cbCardData[2][i*3];
if (cbFirstLogicValue!=(GetCardLogicValue(cbCardData)+i)) return CT_ERROR;
}
if (AnalyseResult.cbBlockCount[2]*3 == cbCardCount)
{
return CT_THREE_LINE;
}
}
else if( cbCardCount == 3 )
{
return CT_THREE;
}
return CT_ERROR;
}




//兩張類型
if (AnalyseResult.cbBlockCount[1]>=3)
{
//變量定義
BYTE cbCardData=AnalyseResult.cbCardData[1][0];
BYTE cbFirstLogicValue=GetCardLogicValue(cbCardData);


//1,2,3不參與連牌
if (cbFirstLogicValue>=14) return CT_ERROR;


//連牌判斷
for (BYTE i=1;i<AnalyseResult.cbBlockCount[1];i++)
{
BYTE cbCardData=AnalyseResult.cbCardData[1][i*2];
if (cbFirstLogicValue!=(GetCardLogicValue(cbCardData)+i)) return CT_ERROR;
}


//二連判斷
if ((AnalyseResult.cbBlockCount[1]*2)==cbCardCount)
{
return CT_DOUBLE_LINE;
}


return CT_ERROR;
}


//單連判斷
if ((AnalyseResult.cbBlockCount[0]>=3)&&(AnalyseResult.cbBlockCount[0]==cbCardCount))
{
//變量定義
BYTE cbCardData=AnalyseResult.cbCardData[0][0];
BYTE cbFirstLogicValue=GetCardLogicValue(cbCardData);


//1,2,3不參與連牌
if (cbFirstLogicValue>=14) return CT_ERROR;


//連牌判斷
for (BYTE i=1; i<AnalyseResult.cbBlockCount[0]; i++)
{
BYTE cbCardData=AnalyseResult.cbCardData[0][i];
if (cbFirstLogicValue!=(GetCardLogicValue(cbCardData)+i)) return CT_ERROR;
}


return CT_SINGLE_LINE;
}
return CT_ERROR;
}


//排列撲克
VOID CGameLogic::SortCardList(BYTE cbCardData[], BYTE cbCardCount, BYTE cbSortType)
{
//數目過慮
if (cbCardCount==0) return;
if (cbSortType==ST_CUSTOM) return;


//轉換數值
BYTE cbSortValue[MAX_COUNT];
for (BYTE i=0;i<cbCardCount;i++) cbSortValue[i]=GetCardLogicValue(cbCardData[i]);


//排序操作
bool bSorted=true;
BYTE cbSwitchData=0,cbLast=cbCardCount-1;
do
{
bSorted=true;
for (BYTE i=0;i<cbLast;i++)
{
if ((cbSortValue[i]<cbSortValue[i+1])||
((cbSortValue[i]==cbSortValue[i+1])&&(cbCardData[i]<cbCardData[i+1])))
{
//設置標志
bSorted=false;


//撲克數據
cbSwitchData=cbCardData[i];
cbCardData[i]=cbCardData[i+1];
cbCardData[i+1]=cbSwitchData;


//排序權位
cbSwitchData=cbSortValue[i];
cbSortValue[i]=cbSortValue[i+1];
cbSortValue[i+1]=cbSwitchData;
}
}
cbLast--;
} while(bSorted==false);


//數目排序
if (cbSortType==ST_COUNT)
{
//變量定義
BYTE cbCardIndex=0;


//分析撲克
tagAnalyseResult AnalyseResult;
AnalysebCardData(&cbCardData[cbCardIndex],cbCardCount-cbCardIndex,AnalyseResult);


//提取撲克
for (BYTE i=0;i<CountArray(AnalyseResult.cbBlockCount);i++)
{
//拷貝撲克
BYTE cbIndex=CountArray(AnalyseResult.cbBlockCount)-i-1;
CopyMemory(&cbCardData[cbCardIndex],AnalyseResult.cbCardData[cbIndex],AnalyseResult.cbBlockCount[cbIndex]*(cbIndex+1)*sizeof(BYTE));


//設置索引
cbCardIndex+=AnalyseResult.cbBlockCount[cbIndex]*(cbIndex+1)*sizeof(BYTE);
}
}


return;
}


//刪除撲克
bool CGameLogic::RemoveCard(const BYTE cbRemoveCard[], BYTE cbRemoveCount, BYTE cbCardData[], BYTE cbCardCount)
{
//檢驗數據
ASSERT(cbRemoveCount<=cbCardCount);


//定義變量
BYTE cbDeleteCount=0,cbTempCardData[MAX_COUNT];
if (cbCardCount>CountArray(cbTempCardData)) return false;
CopyMemory(cbTempCardData,cbCardData,cbCardCount*sizeof(cbCardData[0]));


//置零撲克
for (BYTE i=0;i<cbRemoveCount;i++)
{
for (BYTE j=0;j<cbCardCount;j++)
{
if (cbRemoveCard[i]==cbTempCardData[j])
{
cbDeleteCount++;
cbTempCardData[j]=0x00;
break;
}
}
}
if (cbDeleteCount!=cbRemoveCount) return false;


//清理撲克
BYTE cbCardPos=0;
ZeroMemory(cbCardData,cbCardCount);
for (BYTE i=0;i<cbCardCount;i++)
{
if (cbTempCardData[i]!=0x00) cbCardData[cbCardPos++]=cbTempCardData[i];
}


return true;
}


//邏輯數值
BYTE CGameLogic::GetCardLogicValue(BYTE cbCardData)
{
//撲克屬性
BYTE cbCardColor=GetCardColor(cbCardData);
BYTE cbCardValue=GetCardValue(cbCardData);


//轉換數值
return (cbCardValue<=3 && cbCardValue>=1)?(cbCardValue+13):cbCardValue;
}


//對比撲克
bool CGameLogic::CompareCard(const BYTE cbFirstCard[], const BYTE cbNextCard[], BYTE cbFirstCount, BYTE cbNextCount)
{
//獲取類型
BYTE cbNextType=GetCardType(cbNextCard,cbNextCount);
BYTE cbFirstType=GetCardType(cbFirstCard,cbFirstCount);


//類型判斷
if (cbNextType==CT_ERROR || cbFirstType==CT_ERROR) return false;


//規則判斷
if ((cbFirstType!=cbNextType)||(cbFirstCount!=cbNextCount)) return false;

//只比第一張
return GetCardLogicValue(cbNextCard[0])>GetCardLogicValue(cbFirstCard[0]);
}


//分析撲克
VOID CGameLogic::AnalysebCardData(const BYTE cbCardData[], BYTE cbCardCount, tagAnalyseResult & AnalyseResult)
{
//設置結果
ZeroMemory(&AnalyseResult,sizeof(AnalyseResult));


//撲克分析
for (BYTE i=0;i<cbCardCount;i++)
{
//變量定義
BYTE cbSameCount=1,cbCardValueTemp=0;
BYTE cbLogicValue=GetCardLogicValue(cbCardData[i]);


//搜索同牌
for (BYTE j=i+1;j<cbCardCount;j++)
{
//獲取撲克
if (GetCardLogicValue(cbCardData[j])!=cbLogicValue) break;


//設置變量
cbSameCount++;
}


//設置結果
BYTE cbIndex=AnalyseResult.cbBlockCount[cbSameCount-1]++;
for (BYTE j=0;j<cbSameCount;j++) AnalyseResult.cbCardData[cbSameCount-1][cbIndex*cbSameCount+j]=cbCardData[i+j];


//設置索引
i+=cbSameCount-1;
}


return;
}


//最大牌值
BYTE CGameLogic::GetAllUserLargestCardLogicValue(void)
{
BYTE LargestCardLogicValue = 0x00;
for (int playerID=0; playerID<3; playerID++)
{
for (int i=0;i<m_cbUserCardCount[playerID];i++)
{
if (GetCardLogicValue(m_cbAllCardData[playerID][i]) > LargestCardLogicValue)
{
LargestCardLogicValue = GetCardLogicValue(m_cbAllCardData[playerID][i]);
}
}
}
return LargestCardLogicValue;
}




//獲得最小牌
BYTE CGameLogic::GetLestCard(const BYTE cbCardData[], BYTE cbCardCount)
{
if(cbCardCount == 0) return 0;?
BYTE cbTmpCardData[MAX_COUNT] = {0};
CopyMemory(cbTmpCardData,cbCardData,cbCardCount);
SortCardList(cbTmpCardData,cbCardCount,ST_ORDER);
return cbTmpCardData[cbCardCount-1];
}


//莊家是否就剩一張牌了
bool CGameLogic::IsBankerOnlyHaveOneCard(void)
{
return m_cbUserCardCount[m_wBankerUser] == 1 ? true : false;
}


//獲得最小雙牌
bool CGameLogic::GetLestDoubleCards(const BYTE cbHandCardData[], BYTE cbHandCardCount, BYTE cbLestDoubleCards[2])
{
//存在雙牌
bool bExistDoubleCards = false;
for (int i=cbHandCardCount-1; i>=0; i--)
{
BYTE cbCardCount = 1;
cbLestDoubleCards[0]=cbHandCardData[i];
if (cbLestDoubleCards[0] == 0x00) continue;
for (int j=0; j<cbHandCardCount; j++)
{
if (GetCardLogicValue(cbHandCardData[i])==GetCardLogicValue(cbHandCardData[j]) && i!=j)
{
cbCardCount = 2;
cbLestDoubleCards[1]=cbHandCardData[j];
return true;
}
}
}
ZeroMemory(cbLestDoubleCards,sizeof(BYTE)*2);
return false;
}




//只分析對子
void CGameLogic::AnalyseDoubleCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbDoubleCards)
{
//三牌,四牌也算對子
ZeroMemory(&cbDoubleCards,sizeof(CardsDistribution));
for (BYTE cbCardID=GetCardLogicValue(GetLestCard(cbHandCardData,cbHandCardCount)); cbCardID<=GetAllUserLargestCardLogicValue(); cbCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[2];
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == cbCardID)
{
cbCardBuffer[iHaveThisCardCount ++] = cbHandCardData[i];
if (iHaveThisCardCount == 2)
{
CopyMemory(cbDoubleCards.cbDoubleCards[cbDoubleCards.cbDoubleCardsCount], cbCardBuffer, 2);
cbDoubleCards.cbDoubleCardsCount ++;
break;
}
}
}
}


}


//只分析三牌
void CGameLogic::AnalyseThreeCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbThreeCards)
{
//四牌也算三牌
ZeroMemory(&cbThreeCards,sizeof(CardsDistribution));
for (BYTE cbCardID=GetCardLogicValue(GetLestCard(cbHandCardData,cbHandCardCount)); cbCardID<=GetAllUserLargestCardLogicValue(); cbCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[3];
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == cbCardID)
{
cbCardBuffer[iHaveThisCardCount ++] = cbHandCardData[i];
if (iHaveThisCardCount == 3)
{
CopyMemory(cbThreeCards.cbThreeCards[cbThreeCards.cbThreeCardsCount], cbCardBuffer, 3);
cbThreeCards.cbThreeCardsCount ++;
break;
}
}
}
}
}


//只分析四牌
void CGameLogic::AnalyseFourCardsOnly(const BYTE cbHandCardData[], BYTE cbHandCardCount, CardsDistribution& cbFourCards)
{
ZeroMemory(&cbFourCards,sizeof(CardsDistribution));
for (BYTE cbCardID=GetCardLogicValue(GetLestCard(cbHandCardData,cbHandCardCount)); cbCardID<=GetAllUserLargestCardLogicValue(); cbCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[4];
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == cbCardID)
{
cbCardBuffer[iHaveThisCardCount ++] = cbHandCardData[i];
if (iHaveThisCardCount == 4)
{
CopyMemory(cbFourCards.cbFourCards[cbFourCards.cbFourCardsCount], cbCardBuffer, 4);
cbFourCards.cbFourCardsCount ++;
break;
}
}
}
}
}


//牌值評估
int CGameLogic::EvaluateUserCards(const BYTE cbCardData[], BYTE cbCardCount)
{
/*
1.擁有一張最大牌 評估值+2
2.擁有一張二大牌 評估值+1
3.擁有一張單牌(小于10) 評估值-1
4.所有牌的平均值a 評估值+(a-7)* 2
5.牌的手數 ? ? ? ? ? ? ? ? ? ? ?評估值+(4-a)*4
*/

//大牌評估
int iEvaluateValue = 0;
BYTE LargestCardLogicValue = GetAllUserLargestCardLogicValue();
for (int i=0; i<cbCardCount; i++)
{
if (GetCardLogicValue(cbCardData[i]) == LargestCardLogicValue)
{
iEvaluateValue += 2;
}
}
for (int i=0; i<cbCardCount; i++)
{
if (GetCardLogicValue(cbCardData[i]) == LargestCardLogicValue-1)
{
iEvaluateValue += 1;
}
}


//單牌評估
CardsDistribution myCardsDistribution;
AnalyseMyCards(cbCardData,cbCardCount,myCardsDistribution);
BYTE Card10LogicValue = GetCardLogicValue(0x0A);
for (int i=0; i<myCardsDistribution.cbSingleCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) < Card10LogicValue)
{
iEvaluateValue -= 1;
}
}


//平均值評估
int AllCardsSum = 0;
for (int i=0; i<cbCardCount; i++)
{
AllCardsSum += GetCardLogicValue(cbCardData[i]);
}
iEvaluateValue += ((AllCardsSum/cbCardCount)-7) * 2;


//牌的手數
CardsDistribution tCardsDistribution;
AnalyseMyCards(cbCardData,cbCardCount,tCardsDistribution);
int cardsOutCount = tCardsDistribution.cbSingleCardsCount + tCardsDistribution.cbDoubleCardsCount + tCardsDistribution.cbThreeCardsCount + tCardsDistribution.cbFourCardsCount
? ? ? ? ? ? ? ?+ tCardsDistribution.cbSingleLineCardsCount[0]+ tCardsDistribution.cbSingleLineCardsCount[1] + tCardsDistribution.cbDoubleLineCardsCount[0] + tCardsDistribution.cbThreeLineCardsCount[0] ;

iEvaluateValue += (4 - cardsOutCount)*4;


return iEvaluateValue;
}


//
//連牌搜索
//參數三:連牌中最小值 ? 參數四:單連、雙連、三連、四連 ? 參數五:連子的長度
bool CGameLogic::SearchLineCardType(const BYTE cbHandCardData[], BYTE cbHandCardCount, BYTE cbLestCard, BYTE cbBlockCount, BYTE cbLineCount, tagSearchCardResult * pSearchCardResult)
{
ZeroMemory(pSearchCardResult, sizeof(tagSearchCardResult));


//確定起始值
BYTE cbReferIndex = GetCardLogicValue(cbLestCard);


//長度判斷
if(cbHandCardCount < cbLineCount*cbBlockCount) return false;
if (cbReferIndex+cbLineCount-1>GetCardLogicValue(0x0D)) return false;


//拷貝數據
BYTE tmpHandCard[MAX_COUNT] = {0};
CopyMemory(tmpHandCard,cbHandCardData,cbHandCardCount);


//查詢連牌
for (int cardNum=0; cardNum<cbLineCount; cardNum++)
{
//確定牌值
BYTE cbCardLogicValue = GetCardLogicValue(cbLestCard) + cardNum;


//存在該牌
bool bExistThisCard = false;


//單順查詢
for (int i=0;i<cbHandCardCount;i++)
{
if (GetCardLogicValue(tmpHandCard[i]) == cbCardLogicValue)
{
pSearchCardResult->cbResultCard[pSearchCardResult->cbCardCount++] = tmpHandCard[i];
tmpHandCard[i] = 0x00;
if (cbBlockCount==1) bExistThisCard = true;
break;
}
}


//雙連查詢
if (cbBlockCount >= 2)
{
for (int i=0;i<cbHandCardCount;i++)
{
if (GetCardLogicValue(tmpHandCard[i]) == cbCardLogicValue)
{
pSearchCardResult->cbResultCard[pSearchCardResult->cbCardCount++] = tmpHandCard[i];
tmpHandCard[i] = 0x00;
if (cbBlockCount==2) bExistThisCard = true;
break;
}
}
}


//三順查詢
if (cbBlockCount >= 3)
{
for (int i=0;i<cbHandCardCount;i++)
{
if (GetCardLogicValue(tmpHandCard[i]) == cbCardLogicValue)
{
pSearchCardResult->cbResultCard[pSearchCardResult->cbCardCount++] = tmpHandCard[i];
tmpHandCard[i] = 0x00;
if (cbBlockCount==3) bExistThisCard = true;
break;
}
}
}


if (!bExistThisCard)
{
ZeroMemory(pSearchCardResult, sizeof(tagSearchCardResult));
return false;
}
}


//搜到了結果
return true;
}


//分析我的牌
bool CGameLogic::AnalyseMyCards(const BYTE cbCardData[], BYTE cbCardCount, CardsDistribution &myCardsDistribution)
{
//數據校驗
if(cbCardCount <= 0) return false;


//臨時變量
BYTE cbTmpCardData[MAX_COUNT] = {0};
BYTE cbTmpCardCount = cbCardCount;
CopyMemory(cbTmpCardData,cbCardData, cbCardCount);
SortCardList(cbTmpCardData, cbCardCount, ST_ORDER);


//變量初始化
ZeroMemory(&myCardsDistribution, sizeof(myCardsDistribution));


//分析三順
{
//雙連個數
int iThreeLineCount = 0;


//最小的牌
BYTE cbLestCard = GetLestCard(cbTmpCardData, cbTmpCardCount);
for (BYTE cbStartCard=GetCardLogicValue(cbLestCard); cbStartCard<=GetCardLogicValue(0x0B); cbStartCard++)
{
for (int iLineLength=10; iLineLength>=3; iLineLength--)
{
//搜到的結果
tagSearchCardResult tmpResult = {0};
bool bFindResult = SearchLineCardType(cbTmpCardData, cbTmpCardCount, cbStartCard, 3, iLineLength, &tmpResult);
if (bFindResult)
{
//記錄數據
CopyMemory(myCardsDistribution.cbThreeLineCards[iThreeLineCount], tmpResult.cbResultCard, tmpResult.cbCardCount);
myCardsDistribution.cbThreeLineCardsCount[iThreeLineCount]=iLineLength;


//移除數據
RemoveCard(tmpResult.cbResultCard, tmpResult.cbCardCount, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= tmpResult.cbCardCount;
iThreeLineCount ++;
break;
}
}
}
}


//分析雙順
{
//雙連個數
int iDoubleLineCount = 0;


//最小的牌
BYTE cbLestCard = GetLestCard(cbTmpCardData, cbTmpCardCount);
for (BYTE cbStartCard=GetCardLogicValue(cbLestCard); cbStartCard<=GetCardLogicValue(0x0B); cbStartCard++)
{
for (int iLineLength=10; iLineLength>=3; iLineLength--)
{
//搜到的結果
tagSearchCardResult tmpResult = {0};
bool bFindResult = SearchLineCardType(cbTmpCardData, cbTmpCardCount, cbStartCard, 2, iLineLength, &tmpResult);
if (bFindResult)
{
//記錄數據
CopyMemory(myCardsDistribution.cbDoubleLineCards[iDoubleLineCount], tmpResult.cbResultCard, tmpResult.cbCardCount);
myCardsDistribution.cbDoubleLineCardsCount[iDoubleLineCount]=iLineLength;


//移除數據
RemoveCard(tmpResult.cbResultCard, tmpResult.cbCardCount, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= tmpResult.cbCardCount;
iDoubleLineCount ++;
break;
}
}
}
}


//分析單順
{
//單順個數
int iSingleLineCount = 0;


//最小的牌
BYTE cbLestCard = GetLestCard(cbTmpCardData, cbTmpCardCount);
for (BYTE cbStartCard=GetCardLogicValue(cbLestCard); cbStartCard<=GetCardLogicValue(0x0B); cbStartCard++)
{
for (int iLineLength=10; iLineLength>=3; iLineLength--)
{
//搜到的結果
tagSearchCardResult tmpResult = {0};
bool bFindResult = SearchLineCardType(cbTmpCardData, cbTmpCardCount, cbStartCard, 1, iLineLength, &tmpResult);
if (bFindResult)
{
//記錄數據
CopyMemory(myCardsDistribution.cbSingleLineCards[iSingleLineCount], tmpResult.cbResultCard, tmpResult.cbCardCount );
myCardsDistribution.cbSingleLineCardsCount[iSingleLineCount] = iLineLength;


//移除數據
RemoveCard(tmpResult.cbResultCard, tmpResult.cbCardCount, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= tmpResult.cbCardCount;
iSingleLineCount++;
break;
}
}
}
}


//分析四牌
{
//四牌個數
int iFourCardsCount = 0;


for (BYTE cardID=GetCardLogicValue(GetLestCard(cbTmpCardData,cbTmpCardCount)); cardID<=GetCardLogicValue(0x03); cardID++)
{
int iHaveCount = 0;
BYTE cbFourCard[4]={0};
for (int i=0;i<cbTmpCardCount;i++)
{
if (GetCardLogicValue(cbTmpCardData[i]) == cardID)
{
cbFourCard[iHaveCount++]=cbTmpCardData[i];
}
}
if (iHaveCount == 4)
{
//記錄數據
CopyMemory(myCardsDistribution.cbFourCards[iFourCardsCount++], cbFourCard, 4);
myCardsDistribution.cbFourCardsCount ++;


//移除數據
RemoveCard(cbFourCard, 4, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= 4;
}
}
}
//分析三牌
{
//三牌個數
int iThreeCardsCount = 0;


for (BYTE cardID=GetCardLogicValue(GetLestCard(cbTmpCardData,cbTmpCardCount)); cardID<=GetCardLogicValue(0x03); cardID++)
{
int iHaveCount = 0;
BYTE cbThreeCard[3]={0};
for (int i=0;i<cbTmpCardCount;i++)
{
if (GetCardLogicValue(cbTmpCardData[i]) == cardID)
{
cbThreeCard[iHaveCount++]=cbTmpCardData[i];
}
}
if (iHaveCount == 3)
{
//記錄數據
CopyMemory(myCardsDistribution.cbThreeCards[iThreeCardsCount++], cbThreeCard, 3);
myCardsDistribution.cbThreeCardsCount ++;


//移除數據
RemoveCard(cbThreeCard, 3, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= 3;
}
}
}
//分析對子
{
//對子個數
int iDoubleCardsCount = 0;


for (BYTE cardID=GetCardLogicValue(GetLestCard(cbTmpCardData,cbTmpCardCount)); cardID<=GetCardLogicValue(0x03); cardID++)
{
int iHaveCount = 0;
BYTE cbDoubleCard[2]={0};
for (int i=0;i<cbTmpCardCount;i++)
{
if (GetCardLogicValue(cbTmpCardData[i]) == cardID)
{
cbDoubleCard[iHaveCount++]=cbTmpCardData[i];
}
}
if (iHaveCount == 2)
{
//記錄數據
CopyMemory(myCardsDistribution.cbDoubleCards[iDoubleCardsCount++], cbDoubleCard, 2);
myCardsDistribution.cbDoubleCardsCount ++;


//移除數據
RemoveCard(cbDoubleCard, 2, cbTmpCardData, cbTmpCardCount);
cbTmpCardCount -= 2;
}
}
}
//分析單牌
{
//記錄數據
CopyMemory(myCardsDistribution.cbSingleCards, cbTmpCardData, cbTmpCardCount);
myCardsDistribution.cbSingleCardsCount = cbTmpCardCount;
}


return true;
}


//
// 上面:只是分析 ? ? ? ? 下面:動作邏輯
//


//叫分邏輯
BYTE CGameLogic::LandScore(WORD wMeChairID, BYTE cbCurrentLandScore)
{
//
//四個3或者三個3+兩個2或者兩個3+三個2以上 ? 叫3分
//兩個3+兩個2或者三個3+一個2 ? ? ? ? ? ? ? ?叫2分
//無3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 不叫牌 ?
//其他 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?叫1分


//將會叫分
BYTE AndriodWillCall = 0;


//有幾張3
int iHave3Count = 0;
BYTE cbCard3LogicValue = GetCardLogicValue(0x03);
for (int i=0; i<NORMAL_COUNT; i++)
{
if (GetCardLogicValue(m_cbAllCardData[wMeChairID][i]) == cbCard3LogicValue) iHave3Count++;
}


//有幾張2
int iHave2Count = 0;
BYTE cbCard2LogicValue = GetCardLogicValue(0x02);
for (int i=0; i<NORMAL_COUNT; i++)
{
if (GetCardLogicValue(m_cbAllCardData[wMeChairID][i]) == cbCard2LogicValue) iHave2Count++;
}


if (iHave3Count==4 || (iHave3Count==3 && iHave2Count>=2) || (iHave3Count==2 && iHave2Count>=3))
{
AndriodWillCall = 3;
}
else if ((iHave3Count==2 && iHave2Count==2) || (iHave3Count==3))
{
AndriodWillCall = 2;
}
else if (iHave3Count == 0)
{
AndriodWillCall = 0;
}
else
{
AndriodWillCall = 1;
}


return AndriodWillCall > cbCurrentLandScore ? AndriodWillCall : 0;
}


//只考慮自己
bool CGameLogic::OutCardAccordingToMyCards(const BYTE cbHandCardData[], BYTE cbHandCardCount, tagSearchCardResult & m_OutCardResult)
{
//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,NULL,0,m_OutCardResult)) return true;


//分析數據
CardsDistribution myCardsDistribution;
AnalyseMyCards(cbHandCardData, cbHandCardCount, myCardsDistribution);


//出單張牌
if (myCardsDistribution.cbSingleCardsCount >= 1)
{
//防止白扔最大大牌
if (!(myCardsDistribution.cbSingleCardsCount==1 && GetCardLogicValue(myCardsDistribution.cbSingleCards[0])==GetAllUserLargestCardLogicValue()))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleCards[myCardsDistribution.cbSingleCardsCount-1], 1);
return true;
}
}


//出對子牌
if (myCardsDistribution.cbDoubleCardsCount >= 1)
{
if (
//一個小對子
(myCardsDistribution.cbDoubleCardsCount==1 && GetCardLogicValue(myCardsDistribution.cbDoubleCards[0][0])<GetCardLogicValue(0x0A))
//三對以上
||(myCardsDistribution.cbDoubleCardsCount>=3)
//手中的牌已經不多了
||(myCardsDistribution.cbDoubleCardsCount>=1 && cbHandCardCount<=5)
)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[0], 2);
return true;
}
}


//出單順牌
if (myCardsDistribution.cbSingleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[0], myCardsDistribution.cbSingleLineCardsCount[0]);
return true;
}


//出三張牌
if (myCardsDistribution.cbThreeCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbThreeCards[0], 3);
return true;
}


}


//出四張牌
if (myCardsDistribution.cbFourCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbFourCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbFourCards[0], 3);
return true;
}
}


//出雙順
if (myCardsDistribution.cbDoubleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbDoubleLineCardsCount[0] * 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleLineCards[0], myCardsDistribution.cbDoubleLineCardsCount[0]*2);
return true;
}


return true;
}


//能壓就壓
bool CGameLogic::OutCardForced(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult)
{
//變量初始化
ZeroMemory(&m_OutCardResult,sizeof(tagSearchCardResult));


//牌的類型
BYTE userCardType = GetCardType(cbTurnCardData,cbTurnCardCount);


//自己的牌
CardsDistribution myCardsDistribution;
AnalyseMyCards(cbHandCardData,cbHandCardCount,myCardsDistribution);


switch (userCardType)
{
case CT_SINGLE:
{
if (myCardsDistribution.cbSingleCardsCount > 0)//有單牌
{
for (int i=myCardsDistribution.cbSingleCardsCount-1; i>=0; i--)
{
//尋找單排中打得過的
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleCards[i], 1);
return true;
}


}
//沒有找到
if (GetCardLogicValue(cbHandCardData[0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, cbHandCardData, 1);
return true;
}
}
else//無單牌
{
//最大牌打死
if (GetCardLogicValue(cbHandCardData[0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, cbHandCardData, 1);
return true;
}
}
}
break;
case CT_DOUBLE:
{
if (myCardsDistribution.cbDoubleCardsCount > 0)//有對子
{
for (int i=0; i<myCardsDistribution.cbDoubleCardsCount; i++)
{
//尋找對子中打得過的
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbDoubleCards[i], 2);
return true;
}
}
}
}
else//無對子
{
//用三牌拆
if (myCardsDistribution.cbThreeCardsCount > 0)//有三牌
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 2);
return true;
}
}
}


//用四牌拆
if (myCardsDistribution.cbFourCardsCount > 0)//有四牌
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 2);
return true;
}
}
}


//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x03); iCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[4] = {0};
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == iCardID)
{
cbCardBuffer[iHaveThisCardCount++] = cbHandCardData[i];
}
}
if (iHaveThisCardCount>=2)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, cbCardBuffer, 2);
return true;
}
}
}
}
break;
case CT_THREE:
{
if (myCardsDistribution.cbThreeCardsCount > 0)//有三牌
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return true;
}
}
}
}


//用四牌拆
if (myCardsDistribution.cbFourCardsCount > 0)//有四牌
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 3);
return true;
}


}
}
}


//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x03); iCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[4] = {0};
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == iCardID)
{
cbCardBuffer[iHaveThisCardCount++] = cbHandCardData[i];
}
}
if (iHaveThisCardCount>=3)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, cbCardBuffer, 3);
return true;
}
}
}
break;
case CT_BOMB_CARD:
{
if (myCardsDistribution.cbFourCardsCount > 0)//有四牌
{
for (int i=myCardsDistribution.cbFourCardsCount-1; i>=0; i--)
{
//尋找四牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return true;
}


}
}
}


//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x03); iCardID++)
{
int iHaveThisCardCount = 0;
BYTE cbCardBuffer[4] = {0};
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == iCardID)
{
cbCardBuffer[iHaveThisCardCount++] = cbHandCardData[i];
}
}
if (iHaveThisCardCount>=4)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, cbCardBuffer, 4);
return true;
}
}
}
break;
case CT_SINGLE_LINE:
{
//遍歷所有鏈子
for (int i=0; i<7; i++)
{
//鏈子數目正好
if (myCardsDistribution.cbSingleLineCardsCount[i] == cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][cbTurnCardCount-1]))
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbSingleLineCards[i], cbTurnCardCount);
return true;
}
}
}


//不行就拆
for (int i=0; i<7; i++)
{
//可以拆成兩聯鏈子
if (myCardsDistribution.cbSingleLineCardsCount[i] >= cbTurnCardCount + 3)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][myCardsDistribution.cbSingleLineCardsCount[i]-1]))
{
//挑大的出
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[i][0] + myCardsDistribution.cbSingleLineCardsCount[i] - cbTurnCardCount, cbTurnCardCount);
return true;
}
}
}


//不能拆成兩聯也得打死
for (int i=0; i<7; i++)
{
if (myCardsDistribution.cbSingleLineCardsCount[i] > cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][myCardsDistribution.cbSingleLineCardsCount[i]-1]))
{
//挑大的出
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[i][0] + myCardsDistribution.cbSingleLineCardsCount[i] - cbTurnCardCount, cbTurnCardCount);
return true;
}
}
}


//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x0B); iCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindLine = SearchLineCardType(cbHandCardData,cbHandCardCount,iCardID,1,cbTurnCardCount,&SearchLineCardResult);
if (bFindLine)
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, cbTurnCardCount);
return true;
}
}
}
break;
case CT_DOUBLE_LINE:
{
//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x0B); iCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindLine = SearchLineCardType(cbHandCardData,cbHandCardCount,iCardID,2,cbTurnCardCount/2,&SearchLineCardResult);
if (bFindLine)
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, cbTurnCardCount);
return true;
}
}
}
break;
case CT_THREE_LINE:
{
//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x0B); iCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindLine = SearchLineCardType(cbHandCardData,cbHandCardCount,iCardID,3,cbTurnCardCount/3,&SearchLineCardResult);
if (bFindLine)
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, cbTurnCardCount);
return true;
}
}
}
break;
case CT_FOUR_LINE:
{//概率太小,先不考慮
}
break;
default:
break;
}
return true;
}
//


//出牌搜索
bool CGameLogic::SearchOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, WORD wOutCardUser, WORD wMeChairID, tagSearchCardResult & m_OutCardResult)
{
//玩家判斷
WORD wUndersideOfBanker = (m_wBankerUser+1)%GAME_PLAYER ; //地主下家
WORD wUpsideOfBanker = (wUndersideOfBanker+1)%GAME_PLAYER ; //地主上家


//初始變量
ZeroMemory(&m_OutCardResult, sizeof(m_OutCardResult)) ;

//強制拐牌
OutBigCardsFirst(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,wMeChairID,m_OutCardResult);
if (m_OutCardResult.cbCardCount != 0) return true;


//先出牌
if(cbTurnCardCount==0)
{
//地主出牌
if(wMeChairID==m_wBankerUser) BankerOutCard(cbHandCardData, cbHandCardCount, m_OutCardResult) ;
//地主下家
else if(wMeChairID==wUndersideOfBanker) UndersideOfBankerOutCard(cbHandCardData, cbHandCardCount,wMeChairID, ?m_OutCardResult) ;
//地主上家
else if(wMeChairID==wUpsideOfBanker) UpsideOfBankerOutCard(cbHandCardData, cbHandCardCount, wMeChairID, m_OutCardResult) ;
//錯誤 ID
else ASSERT(false) ;
}
//壓牌
else
{
//地主出牌
if(wMeChairID==m_wBankerUser) BankerOutCard(cbHandCardData, cbHandCardCount, wOutCardUser, cbTurnCardData, cbTurnCardCount, m_OutCardResult) ;
//地主下家
else if(wMeChairID==wUndersideOfBanker) UndersideOfBankerOutCard(cbHandCardData, cbHandCardCount, wOutCardUser, cbTurnCardData, cbTurnCardCount, m_OutCardResult) ;
//地主上家
else if(wMeChairID==wUpsideOfBanker) UpsideOfBankerOutCard(cbHandCardData, cbHandCardCount, wOutCardUser, cbTurnCardData, cbTurnCardCount, m_OutCardResult) ;
//錯誤 ID
else ASSERT(false) ;


}
return true ;
}


//莊家出牌(已令牌)
VOID CGameLogic::BankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, tagSearchCardResult & m_OutCardResult)?
{
//考慮自己
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
return ;
}


//莊家出牌(跟牌)
VOID CGameLogic::BankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult)?
{
//牌的類型
BYTE userCardType = GetCardType(cbTurnCardData,cbTurnCardCount);
CardsDistribution myCardsDistribution;
AnalyseMyCards(cbHandCardData,cbHandCardCount,myCardsDistribution);

//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult)) return ;
switch (userCardType)
{
case CT_SINGLE:
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
break;
case CT_DOUBLE:
{
//盡量打死
if (myCardsDistribution.cbDoubleCardsCount > 0)//有對子
{
for (int i=0; i<myCardsDistribution.cbDoubleCardsCount; i++)
{
//尋找對子中打得過的
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>5 && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbDoubleCards[i], 2);
return;
}
}
}
}
else//無對子
{
//用三牌拆
if (myCardsDistribution.cbThreeCardsCount > 0)//有三牌
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 2);
return;
}
}
}
//用四牌拆
if (myCardsDistribution.cbFourCardsCount > 0)//有四牌
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
//尋找四牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 2);
return;
}
}
}
//死活打死
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}


//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
break;
case CT_THREE:
{
//有三牌
if (myCardsDistribution.cbThreeCardsCount > 0)//有三牌
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>6 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return;
}
}
}
}
//用四牌拆
if (myCardsDistribution.cbFourCardsCount > 0)//有四牌
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 3);
return;
}


}
}
}


//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
break;
case CT_BOMB_CARD:
{
//有四牌
if (myCardsDistribution.cbFourCardsCount > 0)
{
for (int i=myCardsDistribution.cbFourCardsCount-1; i>=0; i--)
{
//尋找三牌中打得過的
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetAllUserLargestCardLogicValue()&& cbHandCardCount>7 && GetCardType(m_cbAllCardData[m_wBankerUser],m_cbUserCardCount[m_wBankerUser]) == CT_ERROR))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return;
}


}
}
}
//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
break;
case CT_SINGLE_LINE:
{
//鏈子到頂
if (GetCardLogicValue(cbTurnCardData[0]) == GetCardLogicValue(0x0D)) return;


//遍歷所有鏈子
for (int i=0; i<7; i++)
{
//鏈子數目正好
if (myCardsDistribution.cbSingleLineCardsCount[i] == cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][cbTurnCardCount-1]))
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbSingleLineCards[i], cbTurnCardCount);
return;
}
}
}


//不行就拆
for (int i=0; i<7; i++)
{
//可以拆成兩聯鏈子
if (myCardsDistribution.cbSingleLineCardsCount[i] >= cbTurnCardCount + 3)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][myCardsDistribution.cbSingleLineCardsCount[i]-1]))
{
//挑大的出
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[i][0] + myCardsDistribution.cbSingleLineCardsCount[i] - cbTurnCardCount, cbTurnCardCount);
return;
}
}
}


//不能拆成兩聯也得打死
for (int i=0; i<7; i++)
{
if (myCardsDistribution.cbSingleLineCardsCount[i] > cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][myCardsDistribution.cbSingleLineCardsCount[i]-1]))
{
//挑大的出
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[i][0] + myCardsDistribution.cbSingleLineCardsCount[i] - cbTurnCardCount, cbTurnCardCount);
return;
}
}
}


//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
break;


case CT_DOUBLE_LINE:
{
//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x0B); iCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindLine = SearchLineCardType(cbHandCardData,cbHandCardCount,iCardID,2,cbTurnCardCount/2,&SearchLineCardResult);
if (bFindLine)
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, cbTurnCardCount);
return ;
}
}
//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
break;
case CT_THREE_LINE:
{
//只要能打死肯定得打死
for (int iCardID=GetCardLogicValue(cbTurnCardData[0])+1; iCardID<=GetCardLogicValue(0x0B); iCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindLine = SearchLineCardType(cbHandCardData,cbHandCardCount,iCardID,3,cbTurnCardCount/3,&SearchLineCardResult);
if (bFindLine)
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, cbTurnCardCount);
return ;
}
}
//強制打死
if (GetCardType(m_cbAllCardData[wOutCardUser] ,m_cbUserCardCount[wOutCardUser]) != CT_ERROR)
{
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
case CT_FOUR_LINE:
{//暫不考慮
}
break;
}
}


//莊家上家(已令牌)
VOID CGameLogic::UpsideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wMeChairID, tagSearchCardResult & m_OutCardResult)
{
//分析自己能走的可能性
BYTE cbFriendChairID = (wMeChairID+2) % GAME_PLAYER;
bool cbThinkMyself = false;
if (EvaluateUserCards(cbHandCardData,cbHandCardCount) > EvaluateUserCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID])+1)
{
cbThinkMyself = true;
}
CardsDistribution myCardsDistribution;
AnalyseMyCards(cbHandCardData,cbHandCardCount,myCardsDistribution);


//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,NULL,0,m_OutCardResult)) return ;


if (cbThinkMyself)//考慮自己
{
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
if (IsBankerOnlyHaveOneCard() && m_OutCardResult.cbCardCount==1)
{
//出對子牌
if (myCardsDistribution.cbDoubleCardsCount >= 1)
{
if (
//一個小對子
(myCardsDistribution.cbDoubleCardsCount==1 && GetCardLogicValue(myCardsDistribution.cbDoubleCards[0][0])<GetCardLogicValue(0x0A))
//三對以上
||(myCardsDistribution.cbDoubleCardsCount>=3)
//手中的牌已經不多了
||(myCardsDistribution.cbDoubleCardsCount>=1 && cbHandCardCount<5)
)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[0], 2);
return ;
}
}


//出單順牌
if (myCardsDistribution.cbSingleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[0], myCardsDistribution.cbSingleLineCardsCount[0]);
return ;
}


//出三張牌
if (myCardsDistribution.cbThreeCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbThreeCards[0], 3);
return ;
}


}


//出四張牌
if (myCardsDistribution.cbFourCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbFourCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbFourCards[0], 3);
return ;
}
}


//出雙順
if (myCardsDistribution.cbDoubleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbDoubleLineCardsCount[0] * 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleLineCards[0], myCardsDistribution.cbDoubleLineCardsCount[0]*2);
return ;
}
}
return;
}
else//給隊友送牌
{
//分析隊友的牌
CardsDistribution friendCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID],friendCardsDistribution);


//分析我自己的牌
CardsDistribution myCardsDistribution;
AnalyseMyCards(m_cbAllCardData[wMeChairID],m_cbUserCardCount[wMeChairID],myCardsDistribution);


//能跑就跑---出雙順
if (myCardsDistribution.cbDoubleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbDoubleLineCardsCount[0] * 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleLineCards[0], myCardsDistribution.cbDoubleLineCardsCount[0]*2);
return ;
}


//能跑就跑---出單順牌
if (myCardsDistribution.cbSingleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[0], myCardsDistribution.cbSingleLineCardsCount[0]);
return ;
}

//試著送隊友
if (friendCardsDistribution.cbSingleLineCardsCount[0] > 0)//隊友要鏈子
{
for (int i=0; i<7; i++)
{
if (friendCardsDistribution.cbSingleLineCardsCount[i] == 0) break;
int iLineCardsLength = friendCardsDistribution.cbSingleLineCardsCount[i];


//媽的,拆機器買零件的送
for (BYTE cbCardID=GetCardLogicValue(GetLestCard(cbHandCardData,cbHandCardCount)); cbCardID<GetCardLogicValue(friendCardsDistribution.cbSingleLineCards[i][0]); cbCardID++)
{
tagSearchCardResult SearchLineCardResult;
bool bFindIt = SearchLineCardType(cbHandCardData,cbHandCardCount,cbCardID,1,iLineCardsLength,&SearchLineCardResult);
if (bFindIt)
{
m_OutCardResult.cbCardCount = iLineCardsLength;
CopyMemory(m_OutCardResult.cbResultCard, SearchLineCardResult.cbResultCard, iLineCardsLength);
return ;
}
}
}
}
if(friendCardsDistribution.cbDoubleCardsCount > 0)//隊友要對子
{
//能送小雙
BYTE cbMyLestDoubleCards[2] = {0};
if (GetLestDoubleCards(cbHandCardData,cbHandCardCount,cbMyLestDoubleCards))
{
if (GetCardLogicValue(cbMyLestDoubleCards[0]) < GetCardLogicValue(friendCardsDistribution.cbDoubleCards[0][0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, cbMyLestDoubleCards, 2);
return ;
}
}
}
//出一張大牌死頂
for (int i=cbHandCardCount-1; i>=0; i--)
{
if (GetCardLogicValue(cbHandCardData[i]) < GetCardLogicValue(m_cbAllCardData[cbFriendChairID][0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &cbHandCardData[i], 1);
return ;
}
}
}
}


//莊家上家(跟牌)
VOID CGameLogic::UpsideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult)?
{
//出牌類型
BYTE cbOutCardType = GetCardType(cbTurnCardData, cbTurnCardCount);


//分析自己能走的可能性
BYTE cbFriendChairID = (m_wBankerUser+1) % GAME_PLAYER;
BYTE cbMeChairID = (m_wBankerUser+2) % GAME_PLAYER;
bool cbThinkMyself = false;
if (EvaluateUserCards(cbHandCardData,cbHandCardCount) > EvaluateUserCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID])+1)
{
cbThinkMyself = true;
}


//分析隊友的牌
CardsDistribution friendCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID],friendCardsDistribution);


//分析自己的牌
CardsDistribution myCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbMeChairID],m_cbUserCardCount[cbMeChairID],myCardsDistribution);


//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult)) return ;
switch (cbOutCardType)
{
case CT_SINGLE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (IsBankerOnlyHaveOneCard())
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = cbHandCardData[0];
}
return ;
}
else//考慮隊友
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (IsBankerOnlyHaveOneCard())
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = cbHandCardData[0];
}
return ;
}
}
else//出牌人是隊友
{
//莊家只剩一張牌了
if (IsBankerOnlyHaveOneCard())
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = cbHandCardData[0];
return ;
}
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbSingleCardsCount > 0)//沒有單牌就不接了
{
for (int i=myCardsDistribution.cbSingleCardsCount-1; i>=0; i--)
{
//尋找單排中打得過的
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) > GetCardLogicValue(cbTurnCardData[0]) && GetCardLogicValue(myCardsDistribution.cbSingleCards[i])!=GetAllUserLargestCardLogicValue())
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleCards[i], 1);
return ;
}
}
}
else
{
return ;
}
}
else//考慮隊友
{
if (GetCardLogicValue(cbTurnCardData[0]) > GetAllUserLargestCardLogicValue() -4)//牌已經夠大了
{//不做處理
}
else //牌太小了,頂一下
{
for (int i=myCardsDistribution.cbSingleCardsCount-1; i>=0; i--)
{
//尋找單排中打得過的
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) > GetAllUserLargestCardLogicValue()-4)
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleCards[i], 1);
return ;
}
}
}


for (BYTE cbCardId=GetAllUserLargestCardLogicValue()-3; cbCardId>=4; cbCardId--)
{
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == cbCardId)
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &cbHandCardData[i], 1);
return ;
}
}
}
}


}
}
}


break;
case CT_DOUBLE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else//考慮隊友
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
else//出牌人是隊友
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbDoubleCardsCount > 0)//沒有雙牌就不接了
{
for (int i=0; i<myCardsDistribution.cbDoubleCardsCount; i++)
{
//尋找對子中打得過的
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) < GetAllUserLargestCardLogicValue() -2)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[i], 2);
return ;
}
else
{
return ;
}
}
}
}
else
{
return ;
}
}
else//考慮隊友
{
if (GetCardLogicValue(cbTurnCardData[0]) >GetAllUserLargestCardLogicValue() -5)//牌已經夠大了
{//不做處理
}
else //牌太小了,頂一下
{
CardsDistribution cbSeachDoubleCards;
AnalyseDoubleCardsOnly(cbHandCardData,cbHandCardCount,cbSeachDoubleCards);
for (BYTE cbCardId=GetAllUserLargestCardLogicValue()-3; cbCardId>=4; cbCardId--)
{
for (int i=0; i<cbSeachDoubleCards.cbDoubleCardsCount; i++)
{
if (GetCardLogicValue(cbSeachDoubleCards.cbDoubleCards[i][0]) == GetCardLogicValue(cbCardId))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &cbSeachDoubleCards.cbDoubleCards[i], 2);
return ;
}
}
}
}


}
}
}
break;
case CT_THREE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbThreeCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return ;
}
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else//考慮隊友
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (!(GetCardLogicValue(m_OutCardResult.cbResultCard[0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
return ;
}

}
}
else//出牌人是隊友
{
if (cbThinkMyself)
{
if (GetCardLogicValue(cbTurnCardData[0]) < GetAllUserLargestCardLogicValue() - 5)//出牌較小
{
if (myCardsDistribution.cbThreeCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return ;
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else
{
//不管不問
return ;
}
}
else
{
//不管不問
return ;
}
return ;
}
}
break;
case CT_BOMB_CARD:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbFourCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return ;
}
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else//考慮隊友
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (!(GetCardLogicValue(m_OutCardResult.cbResultCard[0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
return ;
}
}
}
else//出牌人是隊友
{
if (cbThinkMyself)
{
if (GetCardLogicValue(cbTurnCardData[0]) < GetAllUserLargestCardLogicValue() - 5)//出牌較小
{
if (myCardsDistribution.cbFourCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return ;
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else
{
//不管不問
return ;
}
}
else
{
//不管不問
return ;
}
return ;
}
}
break;
case CT_SINGLE_LINE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else
{
if (cbThinkMyself)
{
//遍歷所有鏈子
for (int i=0; i<7; i++)
{
//鏈子數目正好
if (myCardsDistribution.cbSingleLineCardsCount[i] == cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][cbTurnCardCount-1]))
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbSingleLineCards[i], cbTurnCardCount);
return;
}
}
}
}
else
{
//不管不問
return ;
}


}
}
break;
default:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else
{
return ;
}
}
break;
}
}


//莊家下家(已令牌)
VOID CGameLogic::UndersideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wMeChairID,tagSearchCardResult & m_OutCardResult)?
{
BYTE cbFriendChairID = (wMeChairID+1) % GAME_PLAYER;
bool cbThinkMyself = false;


//分析隊友的牌
CardsDistribution friendCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID],friendCardsDistribution);


//分析我自己的牌
CardsDistribution myCardsDistribution;
AnalyseMyCards(m_cbAllCardData[wMeChairID],m_cbUserCardCount[wMeChairID],myCardsDistribution);


//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,NULL,0,m_OutCardResult)) return ;


//分析自己能走的可能性
if (EvaluateUserCards(cbHandCardData,cbHandCardCount) > EvaluateUserCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID])+1)
{
cbThinkMyself = true;
}


//下家剩一張
if (m_cbUserCardCount[cbFriendChairID] == 1)
{
if (GetCardLogicValue(cbHandCardData[cbHandCardCount-1]) < GetCardLogicValue(m_cbAllCardData[cbFriendChairID][0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &cbHandCardData[cbHandCardCount-1], 1);
return;
}
}


if (cbThinkMyself)//考慮自己
{
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
if (IsBankerOnlyHaveOneCard() && m_OutCardResult.cbCardCount==1)
{
//出對子牌
if (myCardsDistribution.cbDoubleCardsCount >= 1)
{
if (
//一個小對子
(myCardsDistribution.cbDoubleCardsCount==1 && GetCardLogicValue(myCardsDistribution.cbDoubleCards[0][0])<GetCardLogicValue(0x0A))
//三對以上
||(myCardsDistribution.cbDoubleCardsCount>=3)
//手中的牌已經不多了
||(myCardsDistribution.cbDoubleCardsCount>=1 && cbHandCardCount<5)
)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[0], 2);
return ;
}
}


//出單順牌
if (myCardsDistribution.cbSingleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[0], myCardsDistribution.cbSingleLineCardsCount[0]);
return ;
}


//出三張牌
if (myCardsDistribution.cbThreeCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbThreeCards[0], 3);
return ;
}


}


//出四張牌
if (myCardsDistribution.cbFourCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbFourCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbFourCards[0], 3);
return ;
}
}


//出雙順
if (myCardsDistribution.cbDoubleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbDoubleLineCardsCount[0] * 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleLineCards[0], myCardsDistribution.cbDoubleLineCardsCount[0]*2);
return ;
}


}
return;
}
else//給隊友送牌
{
if (m_cbUserCardCount[cbFriendChairID] == 1)//隊友要單
{
if (myCardsDistribution.cbSingleCardsCount > 0)//自己有單牌
{
//能送走
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[0]) < GetCardLogicValue(friendCardsDistribution.cbSingleCards[friendCardsDistribution.cbSingleCardsCount-1]))
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = myCardsDistribution.cbSingleCards[0];
return ;
}
else
{
//不好送就自己出
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
return ;
}
}
}
else if (m_cbUserCardCount[cbFriendChairID] == 2 && friendCardsDistribution.cbDoubleCardsCount == 1)//隊友要雙
{
if (myCardsDistribution.cbDoubleCardsCount > 0)//自己有對子
{
//能送走
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[0][0]) < GetCardLogicValue(friendCardsDistribution.cbDoubleCards[friendCardsDistribution.cbDoubleCardsCount-1][0]))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard,myCardsDistribution.cbDoubleCards,2);
return ;
}
else
{
//不好送就自己出
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
return ;
}
}
}
//不好送就自己出
OutCardAccordingToMyCards(cbHandCardData,cbHandCardCount,m_OutCardResult);
if (IsBankerOnlyHaveOneCard() && m_OutCardResult.cbCardCount==1)
{
//出對子牌
if (myCardsDistribution.cbDoubleCardsCount >= 1)
{
if (
//一個小對子
(myCardsDistribution.cbDoubleCardsCount==1 && GetCardLogicValue(myCardsDistribution.cbDoubleCards[0][0])<GetCardLogicValue(0x0A))
//三對以上
||(myCardsDistribution.cbDoubleCardsCount>=3)
//手中的牌已經不多了
||(myCardsDistribution.cbDoubleCardsCount>=1 && cbHandCardCount<5)
)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[0], 2);
return ;
}
}


//出單順牌
if (myCardsDistribution.cbSingleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleLineCards[0], myCardsDistribution.cbSingleLineCardsCount[0]);
return ;
}


//出三張牌
if (myCardsDistribution.cbThreeCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbThreeCards[0], 3);
return ;
}


}


//出四張牌
if (myCardsDistribution.cbFourCardsCount >= 1)
{
//防止白扔大牌
if (GetCardLogicValue(myCardsDistribution.cbFourCards[0][0]) < GetAllUserLargestCardLogicValue()-1)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbFourCards[0], 3);
return ;
}
}


//出雙順
if (myCardsDistribution.cbDoubleLineCardsCount[0] != 0)
{
m_OutCardResult.cbCardCount = myCardsDistribution.cbDoubleLineCardsCount[0] * 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleLineCards[0], myCardsDistribution.cbDoubleLineCardsCount[0]*2);
return ;
}
}
return ;
}
}
//莊家下家(跟牌)
VOID CGameLogic::UndersideOfBankerOutCard(const BYTE cbHandCardData[], BYTE cbHandCardCount, WORD wOutCardUser, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult)
{
//出牌類型
BYTE cbOutCardType = GetCardType(cbTurnCardData, cbTurnCardCount);


//分析自己能走的可能性
BYTE cbFriendChairID = (m_wBankerUser+2) % GAME_PLAYER;
BYTE cbMeChairID = (m_wBankerUser+1) % GAME_PLAYER;
bool cbThinkMyself = false;
if (EvaluateUserCards(cbHandCardData,cbHandCardCount) > EvaluateUserCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID])+1)
{
cbThinkMyself = true;
}


//分析隊友的牌
CardsDistribution friendCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbFriendChairID],m_cbUserCardCount[cbFriendChairID],friendCardsDistribution);


//分析自己的牌
CardsDistribution myCardsDistribution;
AnalyseMyCards(m_cbAllCardData[cbMeChairID],m_cbUserCardCount[cbMeChairID],myCardsDistribution);


//我已能贏
if (ICanWin(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult)) return ;


switch (cbOutCardType)
{
case CT_SINGLE:
{
//下家剩一張
if (m_cbUserCardCount[cbFriendChairID] == 1 && wOutCardUser!=cbFriendChairID)
{
if (GetCardLogicValue(cbHandCardData[0]) == GetAllUserLargestCardLogicValue())
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &cbHandCardData[cbHandCardCount-1], 1);
return;
}
}


if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else//考慮隊友
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
else//出牌人是隊友
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbSingleCardsCount > 0)//沒有單牌就不接了
{
for (int i=myCardsDistribution.cbSingleCardsCount-1; i>=0; i--)
{
//尋找單排中打得過的
if (GetCardLogicValue(myCardsDistribution.cbSingleCards[i]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbSingleCards[i], 1);
return ;
}
}
}
else
{
return ;
}
}
else//考慮隊友
{
if (GetCardLogicValue(cbTurnCardData[0]) > GetAllUserLargestCardLogicValue() -4)//牌已經夠大了
{//不做處理
}
else //牌太小了,頂一下
{
for (BYTE cbCardId=GetAllUserLargestCardLogicValue()-3; cbCardId>=4; cbCardId--)
{
for (int i=0; i<cbHandCardCount; i++)
{
if (GetCardLogicValue(cbHandCardData[i]) == cbCardId)
{
m_OutCardResult.cbCardCount = 1;
CopyMemory(m_OutCardResult.cbResultCard, &cbHandCardData[i], 1);
return ;
}
}
}
}


}
}
}


break;
case CT_DOUBLE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else//考慮隊友
{
//隊友沒出,強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
}
else//出牌人是隊友
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbDoubleCardsCount > 0)//沒有對子就不接了
{
for (int i=0; i<myCardsDistribution.cbDoubleCardsCount; i++)
{
//尋找對子中打得過的
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (GetCardLogicValue(myCardsDistribution.cbDoubleCards[i][0]) < GetAllUserLargestCardLogicValue() -2)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, &myCardsDistribution.cbDoubleCards[i], 2);
return ;
}
else
{
return ;
}
}
}
}
else
{
return ;
}
}
else//考慮隊友
{
if (GetCardLogicValue(cbTurnCardData[0]) > GetAllUserLargestCardLogicValue() -5)//牌已經夠大了
{//不做處理
}
else //牌太小了,頂一下
{
CardsDistribution cbSeachDoubleCards;
AnalyseDoubleCardsOnly(cbHandCardData,cbHandCardCount,cbSeachDoubleCards);
for (BYTE cbCardId=GetAllUserLargestCardLogicValue()-3; cbCardId>=4; cbCardId--)
{
for (int i=0; i<cbSeachDoubleCards.cbDoubleCardsCount; i++)
{
if (GetCardLogicValue(cbSeachDoubleCards.cbDoubleCards[i][0]) == GetCardLogicValue(cbCardId))
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbDoubleCards[i], 2);
return ;
}
}
}
}


}
}
}
break;
case CT_THREE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbThreeCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return ;
}
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else//考慮隊友
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (!(GetCardLogicValue(m_OutCardResult.cbResultCard[0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
return ;
}
}
}
else//出牌人是隊友
{
if (cbThinkMyself)
{
if (GetCardLogicValue(cbTurnCardData[0]) < GetAllUserLargestCardLogicValue() - 5)//出牌較小
{
if (myCardsDistribution.cbThreeCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbThreeCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbThreeCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbThreeCards[i], 3);
return ;
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else
{
//不管不問
return ;
}
}
else
{
//不管不問
return ;
}
return ;
}
}
break;
case CT_BOMB_CARD:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
if (cbThinkMyself)//考慮自己
{
if (myCardsDistribution.cbFourCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
if (!(GetCardLogicValue(myCardsDistribution.cbFourCards[i][0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return ;
}
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else//考慮隊友
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
if (!(GetCardLogicValue(m_OutCardResult.cbResultCard[0])==GetCardLogicValue(0x03) && GetCardType(m_cbAllCardData[wOutCardUser],m_cbUserCardCount[wOutCardUser])==CT_ERROR))
{
return ;
}
}
}
else//出牌人是隊友
{
if (cbThinkMyself)
{
if (GetCardLogicValue(cbTurnCardData[0]) < GetAllUserLargestCardLogicValue() - 5)//出牌較小
{
if (myCardsDistribution.cbFourCardsCount > 0)//有就打死
{
for (int i=0; i<myCardsDistribution.cbFourCardsCount; i++)
{
if (GetCardLogicValue(myCardsDistribution.cbFourCards[i][0]) > GetCardLogicValue(cbTurnCardData[0]))
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbFourCards[i], 4);
return ;
}
}
}
else//沒有也不會拆牌
{
return ;
}
}
else
{
//不管不問
return ;
}
}
else
{
//不管不問
return ;
}
return ;
}
}
break;
case CT_SINGLE_LINE:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else
{
if (cbThinkMyself)
{
//遍歷所有鏈子
for (int i=0; i<7; i++)
{
//鏈子數目正好
if (myCardsDistribution.cbSingleLineCardsCount[i] == cbTurnCardCount)
{
//且能大過
if (GetCardLogicValue(cbTurnCardData[0]) < GetCardLogicValue(myCardsDistribution.cbSingleLineCards[i][cbTurnCardCount-1]))
{
m_OutCardResult.cbCardCount = cbTurnCardCount;
CopyMemory(m_OutCardResult.cbResultCard, myCardsDistribution.cbSingleLineCards[i], cbTurnCardCount);
return;
}
}
}
}
else
{
//不管不問
return ;
}


}
}
break;
default:
{
if (wOutCardUser == m_wBankerUser)//出牌人是莊家
{
//強制打死莊家
OutCardForced(cbHandCardData,cbHandCardCount,cbTurnCardData,cbTurnCardCount,m_OutCardResult);
return ;
}
else
{
return ;
}
}
break;
}
}


//強制拐牌
void CGameLogic::OutBigCardsFirst(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, BYTE cbMeChairID, tagSearchCardResult & m_OutCardResult)
{
//一手出完
if (GetCardType(cbHandCardData,cbHandCardCount)!=CT_ERROR && cbTurnCardCount==0)
{
m_OutCardResult.cbCardCount = cbHandCardCount;
CopyMemory(m_OutCardResult.cbResultCard, cbHandCardData, cbHandCardCount);
return ;
}

//對方封頂
if (GetCardLogicValue(cbTurnCardData[0]) == GetAllUserLargestCardLogicValue()) return;


if (cbTurnCardCount == 0)//已經令牌
{
//單牌+一手牌
if (GetCardLogicValue(cbHandCardData[0]) == GetAllUserLargestCardLogicValue())
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbTmpMyCardData,1,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-1) != CT_ERROR)
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = cbHandCardData[0];
return;
}
}


//對子+一手牌
CardsDistribution cbMyCardsDistribution2;
ZeroMemory(&cbMyCardsDistribution2,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(cbHandCardData,cbHandCardCount,cbMyCardsDistribution2);
if (cbMyCardsDistribution2.cbDoubleCardsCount > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1],2,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-2) != CT_ERROR)
{
//我的對子最大
bool bMyDoubleCardsIsBigest = true;
CardsDistribution cbOtherUser1AllDoubleCards;
ZeroMemory(&cbOtherUser1AllDoubleCards,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(m_cbAllCardData[(cbMeChairID+1)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+1)%GAME_PLAYER],cbOtherUser1AllDoubleCards);
if (GetCardLogicValue(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1][0]) < GetCardLogicValue(cbOtherUser1AllDoubleCards.cbDoubleCards[cbOtherUser1AllDoubleCards.cbDoubleCardsCount-1][0]))
{
bMyDoubleCardsIsBigest = false;
}
CardsDistribution cbOtherUser2AllDoubleCards;
ZeroMemory(&cbOtherUser2AllDoubleCards,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(m_cbAllCardData[(cbMeChairID+2)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+2)%GAME_PLAYER],cbOtherUser2AllDoubleCards);
if (GetCardLogicValue(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1][0]) < GetCardLogicValue(cbOtherUser2AllDoubleCards.cbDoubleCards[cbOtherUser2AllDoubleCards.cbDoubleCardsCount-1][0]))
{
bMyDoubleCardsIsBigest = false;
}


//且我這個對子是最大的對子
if (bMyDoubleCardsIsBigest)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1], 2);
return;
}


}
}


//三張+一手牌
CardsDistribution cbMyCardsDistribution3;
ZeroMemory(&cbMyCardsDistribution3,sizeof(CardsDistribution));
AnalyseThreeCardsOnly(cbHandCardData,cbHandCardCount,cbMyCardsDistribution3);
if (cbMyCardsDistribution3.cbThreeCardsCount > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistribution3.cbThreeCards[cbMyCardsDistribution3.cbThreeCardsCount-1],3,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-3) != CT_ERROR)
{
//我的三牌最大
bool bMyThreeCardsIsBigest = true;
CardsDistribution cbOtherUser1AllThreeCards;
ZeroMemory(&cbOtherUser1AllThreeCards,sizeof(CardsDistribution));
AnalyseThreeCardsOnly(m_cbAllCardData[(cbMeChairID+1)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+1)%GAME_PLAYER],cbOtherUser1AllThreeCards);
if (GetCardLogicValue(cbMyCardsDistribution3.cbThreeCards[cbMyCardsDistribution3.cbThreeCardsCount-1][0]) < GetCardLogicValue(cbOtherUser1AllThreeCards.cbThreeCards[cbOtherUser1AllThreeCards.cbThreeCardsCount-1][0]))
{
bMyThreeCardsIsBigest = false;
}
CardsDistribution cbOtherUser2AllThreeCards;
ZeroMemory(&cbOtherUser2AllThreeCards,sizeof(CardsDistribution));
AnalyseThreeCardsOnly(m_cbAllCardData[(cbMeChairID+2)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+2)%GAME_PLAYER],cbOtherUser2AllThreeCards);
if (GetCardLogicValue(cbMyCardsDistribution3.cbThreeCards[cbMyCardsDistribution3.cbThreeCardsCount-1][0]) < GetCardLogicValue(cbOtherUser2AllThreeCards.cbThreeCards[cbOtherUser2AllThreeCards.cbThreeCardsCount-1][0]))
{
bMyThreeCardsIsBigest = false;
}


//且我這個三牌是最大的三牌
if (bMyThreeCardsIsBigest)
{
m_OutCardResult.cbCardCount = 3;
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistribution3.cbThreeCards[cbMyCardsDistribution3.cbThreeCardsCount-1], 3);
return;
}


}
}


//四牌+一手牌
CardsDistribution cbMyCardsDistribution4;
ZeroMemory(&cbMyCardsDistribution4,sizeof(CardsDistribution));
AnalyseFourCardsOnly(cbHandCardData,cbHandCardCount,cbMyCardsDistribution4);
if (cbMyCardsDistribution4.cbFourCardsCount > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistribution4.cbFourCards[cbMyCardsDistribution4.cbFourCardsCount-1],4,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-4) != CT_ERROR)
{
//我的三牌最大
bool bMyFourCardsIsBigest = true;
CardsDistribution cbOtherUser1AllFourCards;
ZeroMemory(&cbOtherUser1AllFourCards,sizeof(CardsDistribution));
AnalyseFourCardsOnly(m_cbAllCardData[(cbMeChairID+1)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+1)%GAME_PLAYER],cbOtherUser1AllFourCards);
if (GetCardLogicValue(cbMyCardsDistribution4.cbFourCards[cbMyCardsDistribution4.cbFourCardsCount-1][0]) < GetCardLogicValue(cbOtherUser1AllFourCards.cbFourCards[cbOtherUser1AllFourCards.cbFourCardsCount-1][0]))
{
bMyFourCardsIsBigest = false;
}
CardsDistribution cbOtherUser2AllFourCards;
ZeroMemory(&cbOtherUser2AllFourCards,sizeof(CardsDistribution));
AnalyseFourCardsOnly(m_cbAllCardData[(cbMeChairID+2)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+2)%GAME_PLAYER],cbOtherUser2AllFourCards);
if (GetCardLogicValue(cbMyCardsDistribution4.cbFourCards[cbMyCardsDistribution4.cbFourCardsCount-1][0]) < GetCardLogicValue(cbOtherUser2AllFourCards.cbFourCards[cbOtherUser2AllFourCards.cbFourCardsCount-1][0]))
{
bMyFourCardsIsBigest = false;
}


//且我這個四牌是最大的四牌
if (bMyFourCardsIsBigest)
{
m_OutCardResult.cbCardCount = 4;
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistribution4.cbFourCards[cbMyCardsDistribution4.cbFourCardsCount-1], 4);
return;
}


}
}


//單順+一手牌
CardsDistribution cbMyCardsDistributionSingleLine;
ZeroMemory(&cbMyCardsDistributionSingleLine,sizeof(CardsDistribution));
AnalyseMyCards(cbHandCardData,cbHandCardCount,cbMyCardsDistributionSingleLine);
if (cbMyCardsDistributionSingleLine.cbSingleLineCardsCount[0] > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistributionSingleLine.cbSingleLineCards[0],cbMyCardsDistributionSingleLine.cbSingleLineCardsCount[0],cbTmpMyCardData,cbHandCardCount);
//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-cbMyCardsDistributionSingleLine.cbSingleLineCardsCount[0]) != CT_ERROR)
{
m_OutCardResult.cbCardCount = cbMyCardsDistributionSingleLine.cbSingleLineCardsCount[0];
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistributionSingleLine.cbSingleLineCards[0], cbMyCardsDistributionSingleLine.cbSingleLineCardsCount[0]);
return;
}
}


//雙順+一手牌
CardsDistribution cbMyCardsDistributionDoubleleLine;
ZeroMemory(&cbMyCardsDistributionDoubleleLine,sizeof(CardsDistribution));
AnalyseMyCards(cbHandCardData,cbHandCardCount,cbMyCardsDistributionDoubleleLine);
if (cbMyCardsDistributionDoubleleLine.cbDoubleLineCardsCount[0] > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistributionDoubleleLine.cbDoubleLineCards[0],cbMyCardsDistributionDoubleleLine.cbDoubleLineCardsCount[0]*2,cbTmpMyCardData,cbHandCardCount);
//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-cbMyCardsDistributionDoubleleLine.cbDoubleLineCardsCount[0]*2) != CT_ERROR)
{
m_OutCardResult.cbCardCount = cbMyCardsDistributionDoubleleLine.cbDoubleLineCardsCount[0]*2;
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistributionDoubleleLine.cbDoubleLineCards[0], cbMyCardsDistributionDoubleleLine.cbDoubleLineCardsCount[0]*2);
return;
}
}
}
else//跟牌情況
{
BYTE cbTurnCardType = GetCardType(cbTurnCardData,cbTurnCardCount);
switch (cbTurnCardType)
{
case CT_SINGLE:
{
//單牌+一手牌
if (GetCardLogicValue(cbHandCardData[0]) == GetAllUserLargestCardLogicValue())
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbTmpMyCardData,1,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-1) != CT_ERROR)
{
m_OutCardResult.cbCardCount = 1;
m_OutCardResult.cbResultCard[0] = cbHandCardData[0];
return;
}
}
}
break;
case CT_DOUBLE:
{
//對子+一手牌
CardsDistribution cbMyCardsDistribution2;
ZeroMemory(&cbMyCardsDistribution2,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(cbHandCardData,cbHandCardCount,cbMyCardsDistribution2);
if (cbMyCardsDistribution2.cbDoubleCardsCount > 0)
{
BYTE cbTmpMyCardData[20] = {0};
CopyMemory(cbTmpMyCardData,cbHandCardData,cbHandCardCount);
RemoveCard(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1],2,cbTmpMyCardData,cbHandCardCount);


//剩下的一手出完
if (GetCardType(cbTmpMyCardData,cbHandCardCount-2) != CT_ERROR)
{
//我的對子最大
bool bMyDoubleCardsIsBigest = true;
CardsDistribution cbOtherUser1AllDoubleCards;
ZeroMemory(&cbOtherUser1AllDoubleCards,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(m_cbAllCardData[(cbMeChairID+1)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+1)%GAME_PLAYER],cbOtherUser1AllDoubleCards);
if (GetCardLogicValue(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1][0]) < GetCardLogicValue(cbOtherUser1AllDoubleCards.cbDoubleCards[cbOtherUser1AllDoubleCards.cbDoubleCardsCount][0]))
{
bMyDoubleCardsIsBigest = false;
}
CardsDistribution cbOtherUser2AllDoubleCards;
ZeroMemory(&cbOtherUser2AllDoubleCards,sizeof(CardsDistribution));
AnalyseDoubleCardsOnly(m_cbAllCardData[(cbMeChairID+2)%GAME_PLAYER],m_cbUserCardCount[(cbMeChairID+2)%GAME_PLAYER],cbOtherUser2AllDoubleCards);
if (GetCardLogicValue(cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1][0]) < GetCardLogicValue(cbOtherUser2AllDoubleCards.cbDoubleCards[cbOtherUser2AllDoubleCards.cbDoubleCardsCount][0]))
{
bMyDoubleCardsIsBigest = false;
}


//且我這個對子是最大的對子
if (bMyDoubleCardsIsBigest)
{
m_OutCardResult.cbCardCount = 2;
CopyMemory(m_OutCardResult.cbResultCard, cbMyCardsDistribution2.cbDoubleCards[cbMyCardsDistribution2.cbDoubleCardsCount-1], 2);
return;
}


}
}
}
break;
default:
break;
}
}
}


//我已經能贏
bool CGameLogic::ICanWin(const BYTE cbHandCardData[], BYTE cbHandCardCount, const BYTE cbTurnCardData[], BYTE cbTurnCardCount, tagSearchCardResult & m_OutCardResult)
{
if (GetCardType(cbHandCardData,cbHandCardCount) == CT_ERROR) return false;

if (cbTurnCardCount == 0)
{
m_OutCardResult.cbCardCount = cbHandCardCount;
CopyMemory(m_OutCardResult.cbResultCard, cbHandCardData, cbHandCardCount);
}
else
{
if (CompareCard(cbTurnCardData, cbHandCardData, cbTurnCardCount, cbHandCardCount))
{
m_OutCardResult.cbCardCount = cbHandCardCount;
CopyMemory(m_OutCardResult.cbResultCard, cbHandCardData, cbHandCardCount);
return true;
}
else
{
return false;
}
}
return false;
}


/


總結

以上是生活随笔為你收集整理的挖坑机器人算法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

成人 亚洲 欧美 | 91色在线观看 | 3d黄动漫免费看 | 国产精品系列在线观看 | www.天天成人国产电影 | 亚洲最新av在线网址 | 欧洲精品二区 | 久久精品导航 | 久久久www成人免费精品 | 91精品国产91久久久久 | 精品国产一二三 | 日韩精品第一区 | 成人性生交大片免费看中文网站 | 成人黄在线观看 | 国产在线观看免 | 五月激情电影 | 婷婷六月综合亚洲 | 欧洲亚洲国产视频 | 日韩欧美在线观看一区二区 | 欧美极品一区二区三区 | 国产美女精品在线 | 久久精品一区二区三区国产主播 | 九九免费视频 | 色综合人人 | 久久久国产精品一区二区三区 | 精品国产黄色片 | 日韩精品中文字幕在线不卡尤物 | 日韩午夜小视频 | 国模一二三区 | 美女视频黄是免费的 | 九九激情视频 | 精品国产一二三 | 国产一区二区在线免费 | 久久精品91视频 | 久免费视频 | 91精品久久久久久久久久久久久 | 九九热在线观看 | 97av免费视频 | 久久精品一区二区三区四区 | 国产97视频 | 夜夜夜夜夜夜操 | 三级黄色免费 | 婷婷在线色| 超碰激情在线 | 狠狠天天 | 超碰在线99 | 中文字幕在线影院 | 999国内精品永久免费视频 | 精品美女国产在线 | 国产小视频你懂的在线 | 国产大陆亚洲精品国产 | 久久精品精品电影网 | 天天色天天操天天爽 | 中文字幕av影院 | 黄色成人av在线 | 夜夜操天天干, | 91九色国产在线 | 中文字幕一区二区三区四区在线视频 | 日韩免费电影在线观看 | 一区二区三区中文字幕在线 | 国产精品福利午夜在线观看 | 麻豆传媒在线视频 | 日韩av中文字幕在线 | 五月婷在线观看 | 999久久久久 | 成人福利在线观看 | 午夜私人影院 | 中文字幕乱码电影 | 91精品1区2区 | 国产成人黄色网址 | 插综合网 | 中文av影院 | 国产精品一区免费在线观看 | 色狠狠操 | 九九精品无码 | 日本不卡一区二区三区在线观看 | 黄色软件大全网站 | 欧美精品国产精品 | 成人资源在线观看 | 黄网站免费大全入口 | 少妇bbw揉bbb欧美 | 婷婷六月色 | 69av国产 | 日韩一级黄色大片 | 亚洲精品美女久久久久网站 | 日韩美女av在线 | 久草在线视频网 | 嫩嫩影院理论片 | 国产精品黑丝在线观看 | 成人影视免费看 | 国产精品亚 | av一级二级 | 天天操天天吃 | 午夜三级在线 | 99在线观看免费视频精品观看 | 一级α片 | 香蕉一区 | 808电影免费观看三年 | 精品一区久久 | 亚洲a色 | 中文字幕xxxx| 天天操天天舔天天爽 | 国产在线一区观看 | 美女国产免费 | 五月婷久 | 国产一区影院 | 亚洲三级影院 | 手机看片国产日韩 | 亚洲一区精品人人爽人人躁 | 国产精品久久久久一区二区三区 | 午夜精品久久 | 日韩av成人在线观看 | 久久久受www免费人成 | 久久99久久99精品免观看软件 | 久久综合偷偷噜噜噜色 | 久久成人亚洲欧美电影 | 黄www在线观看 | 国产精品久久久久久一区二区三区 | 国产护士hd高朝护士1 | 五月天婷婷综合 | 91亚洲精品在线 | 色久av| 久久久免费观看完整版 | 91大神精品视频在线观看 | 日韩a级免费视频 | 一级黄色片在线免费看 | 成人a视频片观看免费 | www.夜夜干.com| 成人动漫一区二区三区 | www.777奇米| 欧美一级性生活片 | 久久玖| 欧美日韩国产二区三区 | 日韩高清在线一区二区三区 | 国产成人精品免高潮在线观看 | 91九色成人蝌蚪首页 | 综合久久久 | 婷婷网站天天婷婷网站 | 亚洲精品看片 | 91精品婷婷国产综合久久蝌蚪 | 菠萝菠萝在线精品视频 | av成人黄色 | 91丨九色丨国产女 | 女人18毛片90分钟 | 亚洲japanese制服美女 | 人人网人人爽 | 欧美福利网站 | 国产麻豆视频网站 | 久久伊人色综合 | 91人人网 | 久久久久国产a免费观看rela | 99国产精品一区 | 91在线观看高清 | 欧美特一级片 | 婷婷亚洲综合五月天小说 | 国产精品美女在线 | 综合激情网... | 天天干人人 | 天天艹天天 | 日韩欧美在线综合网 | 国产护士av | 中文字幕一区二区三区在线视频 | 激情欧美一区二区免费视频 | 色a4yy| 国产精品久久久久久久久久99 | 亚洲成人黄色 | 免费看毛片在线 | 天天射夜夜爽 | 午夜久久影视 | 久久久久久草 | 国产69精品久久久久9999apgf | 天天色天天干天天色 | 香蕉视频在线视频 | 色综合婷婷 | 婷婷日 | 青草视频在线 | www.888av| 国产精品久久久久免费观看 | 四虎在线免费观看 | 免费色视频在线 | 人人爽人人爽人人爽 | 国产又黄又爽无遮挡 | 亚洲国产影院 | 国产视频资源 | 免费能看的黄色片 | 最新国产在线视频 | 五月综合婷 | 精品久久久免费视频 | 日日碰狠狠添天天爽超碰97久久 | 视频一区二区视频 | 日韩videos | 国产18精品乱码免费看 | 日韩精品一区二区三区免费观看视频 | 狠狠操狠狠干天天操 | av九九| 亚洲精品在线看 | 很黄很色很污的网站 | 中文字幕av在线电影 | 在线免费黄色av | 91看片淫黄大片在线播放 | 久草综合视频 | 五月天中文字幕 | 在线国产黄色 | 免费在线精品视频 | 精品在线看 | 精品国产一区二区在线 | 97小视频| 日韩另类在线 | 欧美亚洲一区二区在线 | 四虎影视欧美 | 欧美日韩在线观看不卡 | 亚洲欧洲精品一区二区精品久久久 | 久久久久久久影视 | 成人午夜免费剧场 | www视频在线观看 | 在线有码中文 | 91看片一区二区三区 | 麻豆成人精品 | 午夜精品一区二区三区免费 | 成人污视频在线观看 | 国产精品久久久久久久久久东京 | 久久中文字幕视频 | 91福利视频免费观看 | 免费黄av| 区一区二区三在线观看 | 久久一区二区免费视频 | 国产精品麻豆欧美日韩ww | 亚洲高清视频在线观看 | 欧美日韩高清一区 | 成人欧美在线 | 欧美少妇bbwhd | 免费中文字幕在线观看 | 国产精品理论片 | 91九色国产蝌蚪 | 日韩亚洲国产精品 | 午夜精品久久久久久久99 | 最近日本字幕mv免费观看在线 | 久久久99久久 | 国精产品满18岁在线 | 精品国产欧美一区二区三区不卡 | 怡春院av | 天天色天天射天天干 | 91视频高清完整版 | 欧美先锋影音 | 97在线观| 日韩乱色精品一区二区 | 久久久精品久久日韩一区综合 | 91高清免费| 久草在线视频在线 | 综合色亚洲 | 日批在线观看 | 视频成人永久免费视频 | 手机看片1042 | 亚洲无在线 | 涩五月婷婷 | 热久久免费视频精品 | 国产成人av片 | 午夜丁香网 | 亚洲理论视频 | 欧美成人按摩 | 91麻豆精品国产91久久久久 | 91久久奴性调教 | 日韩欧美视频免费看 | 超碰在线97免费 | 麻豆国产露脸在线观看 | 91人人揉日日捏人人看 | 亚洲精品在线视频 | 国产一级视频在线免费观看 | 九九视频在线观看视频6 | 久草在线免费资源 | wwwww.国产| 99在线精品观看 | 91大片网站 | 国产美女无遮挡永久免费 | 狠狠地日 | www.av免费观看 | 色先锋av资源中文字幕 | 国产精品久久久久毛片大屁完整版 | 91自拍成人| 色视频成人在线观看免 | 综合网欧美 | 日日射av| 97超碰香蕉 | www.久久免费视频 | 国产亚洲视频在线免费观看 | 久久人人爽人人爽人人片 | 人人澡人人爽 | 色wwwww | 日韩黄色av网站 | 久久久免费国产 | 日韩一区二区三免费高清在线观看 | 国内精品久久影院 | 九九精品视频在线观看 | 草久视频在线观看 | 国产一级二级三级视频 | 久久久鲁 | 欧美午夜一区二区福利视频 | 一级淫片a | av在线小说| 国产精品18久久久 | 欧美黄色高清 | 欧美精品一区二区性色 | 久久草网站 | 香蕉视频网站在线观看 | 狠狠色丁香久久婷婷综合_中 | 一区二区三区久久 | 激情综合网五月婷婷 | 99国产高清| www在线观看视频 | 天天干,天天射,天天操,天天摸 | 国产女v资源在线观看 | 高清一区二区三区av | 久久久免费看视频 | 中文字幕在线免费播放 | 91高清完整版在线观看 | 麻豆国产电影 | 日韩在线视 | 91高清在线| 国产粉嫩在线观看 | 99精品欧美一区二区蜜桃免费 | 久久开心激情 | 中文字幕高清免费日韩视频在线 | 区一区二区三在线观看 | 午夜久久成人 | 久久精品系列 | 国产一区在线免费 | 亚洲永久国产精品 | 一区二区成人国产精品 | 国产欧美最新羞羞视频在线观看 | 色视频在线免费观看 | 少妇搡bbbb搡bbb搡69 | 久久综合婷婷综合 | 91成年人在线观看 | 欧洲精品码一区二区三区免费看 | av网站大全免费 | 91私密视频 | 国产精品免费成人 | 在线观看成人国产 | 丝袜精品视频 | 五月天综合网站 | 久草精品视频 | 夜夜操狠狠干 | 99r精品视频在线观看 | 网站免费黄 | 午夜久久久精品 | 国产亚洲婷婷免费 | 日韩美一区二区三区 | 色综合色综合色综合 | 久久永久视频 | 91精品久久久久久综合乱菊 | 毛片一区二区 | 久久99国产精品 | 精品国产免费人成在线观看 | 日韩成人精品一区二区三区 | 国产日韩中文字幕在线 | 手机在线日韩视频 | 国产精品久久99综合免费观看尤物 | 国产精品高清在线 | 少妇精品久久久一区二区免费 | 日本高清久久久 | 国产精品观看在线亚洲人成网 | .国产精品成人自产拍在线观看6 | 日本久久片 | 中文字幕在线国产 | 在线 国产一区 | 国产精品一区二区三区免费视频 | 久草在线费播放视频 | 日韩网站在线播放 | 日韩久久精品一区二区三区 | 热久久这里只有精品 | 国产在线视频一区 | 很黄很色很污的网站 | 久操视频在线 | 中文在线天堂资源 | 国产小视频福利在线 | 午夜av剧场 | bbbb操bbbb| 国产成人免费在线 | 日韩一区二区三区高清免费看看 | 成人a在线观看 | 日韩欧美在线高清 | 天天射天天操天天干 | 99热999| 91九色网址 | 午夜av在线 | 日韩激情在线视频 | 久久亚洲区 | 免费特级黄毛片 | 91爱看片 | 精品国产成人在线 | 亚洲精品在线免费看 | 国产精品激情偷乱一区二区∴ | 色午夜影院 | 日韩美在线观看 | 免费亚洲视频在线观看 | 亚洲成人黄 | 亚洲国产播放 | 最新高清无码专区 | 美女网站在线看 | 天天操狠狠操网站 | 中文字幕在线观看亚洲 | 人人干干人人 | 亚洲激情六月 | 三级av片 | 中文字幕在线观看免费高清电影 | 欧美精品一区在线 | av网站手机在线观看 | 99久久婷婷国产 | 超碰97人人爱 | 日韩精品一区二区三区在线播放 | 国产精品免费看 | 狠狠的操狠狠的干 | av3级在线 | 日日爽视频| 日日夜夜精品视频天天综合网 | 激情av综合 | 亚洲免费观看在线视频 | 黄色av网站在线免费观看 | 久久精品视频在线免费观看 | 亚洲日本va在线观看 | 亚洲精品国产成人av在线 | 麻豆影视在线观看 | 国产在线观看免费观看 | 深夜精品福利 | 国产精品精品久久久久久 | 天天射天天干天天插 | 国产高清第一页 | 国产91精品在线观看 | 日p视频在线观看 | 国产黄色片一级三级 | 婷婷六月综合网 | 亚洲乱亚洲乱亚洲 | 亚州精品一二三区 | www夜夜| 狠狠狠狠狠狠狠狠干 | 中文字幕综合在线 | 色香蕉网| 国产理论在线 | 久久久免费毛片 | 国产中文字幕在线观看 | 亚洲乱码一区 | 在线视频专区 | 精品999国产 | 国产日产高清dvd碟片 | av大片免费在线观看 | 国产中的精品av小宝探花 | 久久久精品高清 | 欧美 亚洲 另类 激情 另类 | 亚洲国产精品成人女人久久 | 美女视频免费精品 | 在线观看国产麻豆 | 一区二区三区日韩在线 | 欧美欧美 | 久久综合日 | 亚洲激情国产精品 | 欧美成人亚洲 | 黄色的视频网站 | 天天操天天干天天 | 欧美日韩中文在线视频 | 99久久这里只有精品 | 成人99免费视频 | 五月激情丁香图片 | 色婷婷激情电影 | 国产午夜精品在线 | 在线中文字幕av观看 | 欧美日韩一区二区三区不卡 | 国产精品毛片久久久久久 | 国产91精品久久久久久 | 国产精品久久久久久一区二区 | 一区二区久久 | 日韩大片在线免费观看 | 五月天亚洲激情 | 欧美一级黄色视屏 | 五月婷婷在线视频观看 | 在线观看网站黄 | 制服丝袜亚洲 | 久久九九精品 | 欧美激情精品久久 | a天堂中文在线 | 亚洲一区二区麻豆 | 51精品国自产在线 | 美女视频是黄的免费观看 | 国产精品门事件 | 免费av片在线 | 粉嫩一区二区三区粉嫩91 | 国产一区二区久久 | 91tv国产成人福利 | 国产精品午夜久久久久久99热 | 天天天射 | 久久久综合九色合综国产精品 | 中文在线最新版天堂 | 18pao国产成视频永久免费 | 欧美日韩在线视频一区二区 | 国产精品福利在线 | 岛国大片免费视频 | 久久久精品综合 | 日韩影视在线 | 四虎在线观看精品视频 | 香蕉视频免费在线播放 | 久久免费看a级毛毛片 | 亚洲日本欧美在线 | 国产自偷自拍 | 亚洲aⅴ在线 | www.五月天激情 | 日韩深夜在线观看 | 啪啪凸凸 | 黄色免费网站 | 草久在线播放 | 国产免费三级在线观看 | 五月综合网站 | 91亚洲在线观看 | 中文字幕精品一区二区精品 | www.色午夜 | 精品国产美女在线 | 久久精品爱爱视频 | 99精品国产成人一区二区 | 精品女同一区二区三区在线观看 | 日韩精品一区电影 | 日韩日韩日韩日韩 | www.天天干 | 日本女人的性生活视频 | 国产精品96久久久久久吹潮 | 亚洲精品网站 | 国产成人黄色在线 | 日日夜夜免费精品视频 | 婷婷精品视频 | 免费av视屏 | 日韩欧美69 | 欧美一二三区在线观看 | 日韩欧美一区二区三区视频 | 久久成人免费电影 | 国产真实在线 | 欧美日韩精品二区第二页 | 国产手机在线观看 | 国产黄色大全 | 国产精品18久久久久久久网站 | 91污污视频在线观看 | 国产高清视频免费最新在线 | 天天爱天天操 | 激情久久一区二区三区 | www看片网站| 麻豆免费在线视频 | 日韩久久精品一区二区三区 | 中文区中文字幕免费看 | 久久免费电影网 | 国产免费视频一区二区裸体 | 久久国产91 | 天天爽天天爽夜夜爽 | av在线网站大全 | 国产高清区 | 国产精品不卡视频 | a级片网站 | 精品影院一区二区久久久 | 日韩国产在线观看 | www.激情五月.com| 在线视频a | 亚洲专区在线 | 久久久久北条麻妃免费看 | 国产精品久久久久久久久久东京 | 精品国产免费一区二区三区五区 | 黄色在线小网站 | av电影在线观看完整版一区二区 | 免费观看v片在线观看 | 精品视频在线免费观看 | 91精品国产91 | 久久综合一本 | 国产淫片 | 成人黄色在线观看视频 | 九草视频在线观看 | 日韩中文字幕在线看 | 婷婷色 亚洲 | 最近最新mv字幕免费观看 | 伊人网综合在线观看 | 欧美淫视频 | 亚洲精品免费播放 | 综合视频在线 | 婷婷深爱五月 | 日韩中文在线视频 | 欧美一区二区精品在线 | 午夜视频在线观看一区 | 午夜a区 | 久久国产热| 成人黄色大片在线观看 | 久久一区国产 | 国产男男gay做爰 | 免费又黄又爽 | 久久久久久久国产精品视频 | 久久久久成人精品免费播放动漫 | 国产精品成人自产拍在线观看 | 国产免费又黄又爽 | 日本在线观看视频一区 | 欧美日在线观看 | 日韩精品字幕 | 国产青春久久久国产毛片 | 精品视频免费 | 色综合天天 | 国产999免费视频 | 国产视频 亚洲视频 | 特级a老妇做爰全过程 | 97人人精品| 欧美一级性生活视频 | 天天干天天操天天搞 | 一区二区 精品 | 国产中文 | 在线观看国产区 | 国产在线视频一区二区三区 | 日韩欧美视频一区二区三区 | 亚洲午夜久久久综合37日本 | 亚洲一区二区三区91 | 伊人射 | 久久久三级视频 | 日日碰夜夜爽 | 天天干天天干天天 | 色吊丝在线永久观看最新版本 | 天天射狠狠干 | 91视频高清 | 国产精品大片免费观看 | 国产麻豆视频 | 中文字幕专区高清在线观看 | 成人久久18免费 | 在线视频精品 | 美女黄视频免费 | 黄色小网站在线观看 | 超碰在线人人97 | 香蕉视频在线免费 | 天堂激情网 | 久久天堂亚洲 | 亚洲欧美成人在线 | av高清不卡 | 久色伊人 | 国产一区二区不卡视频 | 精品久久久久久亚洲综合网站 | 欧美激情视频一二三区 | 九九视频免费在线观看 | 国产在线久草 | 国产一区二区精 | 欧美精品中文字幕亚洲专区 | 一级特黄aaa大片在线观看 | 亚洲国产成人av网 | 中文字幕一区二区在线观看 | 国产精品久久久av久久久 | 国产伦精品一区二区三区高清 | 国产精品中文字幕在线 | 天天鲁天天干天天射 | 中文字幕在线观看第三页 | 91久久偷偷做嫩草影院 | 国产精品成人av在线 | 久久免费黄色大片 | 成人在线免费小视频 | 国产一区免费 | 国产又粗又硬又爽的视频 | 黄色日本免费 | 欧美在线一二 | 国产一级电影 | 伊甸园永久入口www 99热 精品在线 | 国产在线资源 | 超碰在线公开 | 91精品视频免费观看 | 91禁看片| 国产黄色片一级三级 | 精品欧美乱码久久久久久 | 91片在线观看| 久草在在线视频 | 一区免费视频 | 国产黑丝一区二区三区 | 国产视频中文字幕 | a在线v| 国产日韩欧美精品在线观看 | 久草久草在线 | 2018亚洲男人天堂 | 亚洲精品免费在线观看视频 | 亚洲一区日韩精品 | 亚洲国产免费av | 天天干天天操天天射 | 亚洲激情视频 | 久久精品国产免费观看 | 18岁免费看片 | 99 色| 久久久国产精华液 | 91成人亚洲| 国产成人精品一区二三区 | 成人国产精品一区 | 免费日韩三级 | 国产精品毛片一区二区 | 久草在线免费看视频 | 国产精品视频在线看 | 国产青草视频在线观看 | 在线免费看黄色 | 在线欧美最极品的av | 激情丁香综合五月 | 91精品国产自产在线观看永久 | 午夜av免费 | 综合色伊人| 国语黄色片 | 超碰在线个人 | 色综合久久88 | 免费a级黄色毛片 | 手机在线看片日韩 | 四虎www com | 色99久久 | 天天曰天天射 | 亚洲人在线7777777精品 | 99热只有精品在线观看 | 亚洲免费精品一区二区 | 国产91精品一区二区麻豆亚洲 | 成人国产精品入口 | 国产精品女视频 | 超碰人人乐| 久久精品视频网站 | 91看片看淫黄大片 | 免费日韩一区 | 成人一区二区在线观看 | 特级毛片网 | 欧美在线观看小视频 | 日韩欧美高清视频在线观看 | 久久久久久欧美二区电影网 | 夜夜躁狠狠燥 | av品善网| 欧美国产视频在线 | 91九色视频在线观看 | 久久久国产电影 | 国产精品99久久久久久宅男 | 欧美91片 | 色多多污污 | 成人黄色免费在线观看 | 日韩免费视频一区二区 | 天天射综合网视频 | 麻豆视频入口 | 亚洲一区二区三区毛片 | 国产一区久久 | 天天天射 | 麻豆影视在线观看 | 日韩精品久久久久久久电影99爱 | www,黄视频| 日韩精品亚洲专区在线观看 | 日韩高清精品一区二区 | 免费在线观看毛片网站 | 在线播放视频一区 | 97人人澡人人爽人人模亚洲 | 在线视频欧美日韩 | 蜜臀av夜夜澡人人爽人人桃色 | 国产免码va在线观看免费 | 婷婷久久综合九色综合 | 麻豆传媒视频观看 | 麻豆传媒在线免费看 | 久久香蕉国产 | 精品国模一区二区三区 | 最新国产一区二区三区 | 97国产大学生情侣酒店的特点 | 亚洲人av免费网站 | 缴情综合网五月天 | 成人久久18免费网站 | 中文字幕黄色av | 手机av电影在线观看 | 精品国内自产拍在线观看视频 | 欧美日韩国产一区二区三区 | 精品女同一区二区三区在线观看 | 亚洲婷婷综合色高清在线 | 国产成人免费 | 亚洲国产久 | 久久99精品久久久久久秒播蜜臀 | av成人黄色 | 久久手机免费观看 | 日韩成人欧美 | 国产综合精品一区二区三区 | 国产成人精品网站 | 一区二区三区视频网站 | 久久亚洲免费 | 天天操夜夜拍 | 精品视频一区在线 | 日韩av免费在线看 | 成人avav| 国产精品久久久久免费 | 九九九热精品免费视频观看 | 伊人六月 | 黄色tv视频 | 在线免费高清 | www.黄色片网站 | 精品欧美小视频在线观看 | 亚洲伊人婷婷 | 免费日韩 精品中文字幕视频在线 | 亚洲精品网址在线观看 | 久久综合狠狠综合 | 色婷婷av一区 | 久久99热这里只有精品 | 中文字幕精品一区二区精品 | 久久丁香 | 亚洲一区美女视频在线观看免费 | 人人澡人人澡人人 | 亚洲va在线va天堂 | 人成午夜视频 | 99精品久久久 | 亚洲国产精品影院 | 韩国一区在线 | 日韩欧美在线高清 | 亚洲影院国产 | 特级a老妇做爰全过程 | 国产高清精品在线 | 一区二区影院 | 国产白浆视频 | 美女视频一区 | 国产原创在线视频 | 91久久国产精品 | 日韩丝袜在线 | 免费涩涩网站 | 一本—道久久a久久精品蜜桃 | 天天色天天搞 | www.色午夜 | 91成人精品 | 免费91在线观看 | 99热最新精品| 久久久免费高清视频 | 久久久久久久久综合 | 日韩久久久久久久 | 波多野结衣小视频 | 国产不卡在线播放 | 免费午夜视频在线观看 | 国内外成人免费在线视频 | 91女神的呻吟细腰翘臀美女 | 日韩精选在线 | 欧洲精品码一区二区三区免费看 | 久久香蕉国产精品麻豆粉嫩av | 久久草视频 | 成年人免费电影在线观看 | 欧美色图视频一区 | 91人人视频在线观看 | 日韩亚洲国产中文字幕 | 天天干夜夜夜 | 黄色avwww | 丁香花五月 | 久久图| 欧美伦理电影一区二区 | 欧美少妇xxxxxx | 色窝资源| 99久久婷婷国产综合精品 | 涩涩网站在线观看 | 久草精品视频 | 五月激情电影 | 婷婷色网站 | 亚洲欧美视频在线观看 | 色免费在线 | 天天干人人干 | 中文字幕av专区 | 最近2019年日本中文免费字幕 | 中文电影网 | 嫩小bbbb摸bbb摸bbb | 亚洲国产一区在线观看 | av在线专区| 黄色免费电影网站 | 超级av在线| 国产96精品 | 中文字幕在线播出 | 天天插天天 | 天天干天天看 | 91亚洲精品久久久 | 亚洲毛片视频 | 在线亚洲成人 | 亚洲艳情| 日韩黄在线观看 | 久草在线91| 久久成人资源 | 日日操夜| 国产精品九九九九九 | 日韩国产欧美在线视频 | 久久区二区 | 国产精品久久久久久久久久三级 | 天无日天天操天天干 | 久久高清免费观看 | 欧美99久久 | 99久久精品一区二区成人 | 久久久午夜精品福利内容 | 国产精品九九九九九 | 国产在线观看免 | 在线观看视频中文字幕 | 亚洲少妇久久 | 91porny九色91啦中文 | 亚洲电影免费 | 久久久精品一区二区三区 | 最新中文在线视频 | 国产99久久九九精品免费 | 97精品超碰一区二区三区 | 欧美一级在线看 | 国产高清不卡在线 | www.久草.com | 亚洲天堂网站 | 中文在线字幕免 | 中文字幕欧美激情 | 国产 在线 高清 精品 | 中文久草 | 日韩在线播放欧美字幕 | 最新一区二区三区 | 久久综合九色综合久99 | 欧美 日韩精品 | 亚洲天天草 | 超碰999| 97香蕉超级碰碰久久免费软件 | 成人av直播| 高清av影院| 色99在线 | 97精品国自产拍在线观看 | 国内精品毛片 | 在线免费看片 | 狠狠色丁香婷综合久久 | 天天搞夜夜骑 | 国产精品99久久免费观看 | 日韩激情视频在线 | 91福利视频一区 | 久精品在线| 国产色视频一区二区三区qq号 | 国产人成看黄久久久久久久久 | 国产尤物一区二区三区 | 麻豆你懂的 | 久久激情视频 久久 | 亚洲精品视频二区 | 97超碰人人澡人人 | 免费看片在线观看 | 色婷五月| 精品99在线视频 | a级片在线播放 | 麻豆91在线 | 中文字幕免费高清在线观看 | 免费在线播放 | 色婷婷播放 | 亚洲精品在线观看不卡 | 国产青草视频在线观看 | 日韩欧美一区二区三区在线观看 | 久久精选视频 | 亚洲日本精品 | 久久免费视频精品 | 欧美先锋影音 | 十八岁以下禁止观看的1000个网站 | 黄色电影网站在线观看 | 亚洲五月综合 | 日韩超碰在线 | 亚洲成人av电影在线 | 日韩区在线观看 | 亚洲91中文字幕无线码三区 | 久久精品在线 | 亚洲成人第一区 | 日韩在线免费观看视频 | 在线看片日韩 | 96超碰在线 | 欧美91精品久久久久国产性生爱 | 香蕉视频在线看 | 国产精品99久久久久 | 欧美激情在线网站 | 国产福利91精品张津瑜 | 波多野结衣久久资源 | 国产精品一区久久久久 | 超碰伊人网 | 99久久精品免费看国产麻豆 | 国产91全国探花系列在线播放 | 中文字幕 婷婷 | 色婷婷久久久综合中文字幕 | 在线观看国产高清视频 | 一级性视频 | 国产中文字幕av | 亚洲色影爱久久精品 | 99精品视频在线观看播放 | 欧美激情综合五月色丁香 | 草草草影院 | 欧美人人| 精品在线播放视频 | 亚洲欧美成人 | 1000部国产精品成人观看 | 三级黄色在线 | 欧美日本在线观看视频 | 久久午夜色播影院免费高清 | 久久九精品 | 在线 成人| 97成人精品区在线播放 | 色噜噜在线观看 | 久久亚洲二区 | 91久久久久久久一区二区 | 97超碰中文字幕 | 激情五月在线视频 | 天天爱天天射 | 日韩激情精品 | 永久免费精品视频网站 | 日韩偷拍精品 | 亚洲天天综合网 | 国产你懂的在线 | 久久久久中文 | 成 人 黄 色视频免费播放 | 丰满少妇久久久 | 欧美成人在线免费 | 日韩一区二区三区高清在线观看 | 久久在线播放 | 在线观看免费成人 | 91精品色| 亚洲免费av在线播放 | 91免费黄视频| 又黄又爽又色无遮挡免费 | wwwwwww黄| 久久九九影视网 | avhd高清在线谜片 | 东方av免费在线观看 | 免费av影视|