📄 weiqibrd.h
字号:
//---------------------------------------------------------------------------
#ifndef weiqibrdH
#define weiqibrdH
const MAXLINES = 21;
enum TWhichSide { wqSideNone = 0, wqSideBlack, wqSideWhite };
enum TGameType { gtPlay = 0, gtLearn, gtWatch };
enum TAdjacentDirection { adTop = 0, adBottom, adLeft, adRight };
struct TAdjacentInformation
{
int nTotal;
int nX;
int nY;
bool bTop;
bool bBottom;
bool bLeft;
bool bRight;
};
struct TBlock
{
int nNo;
int nX;
int nY;
TBlock *pNext;
};
struct TSituationTree
{
TWhichSide WhichSide;
int nBreath;
TBlock *pBlock;
TSituationTree *pNext;
};
//---------------------------------------------------------------------------
class TWeiqiBoard : public TObject
{
friend class TMainFormWeiqi;
private:
int Order;
int BlackDeadStones, WhiteDeadStones;
SYSTEMTIME StartTime, BlackUsedTime, WhiteUsedTime;
TWhichSide Phase[ MAXLINES ][ MAXLINES ];
TSituationTree *pSituationTree;
public:
__fastcall TWeiqiBoard();
virtual __fastcall ~TWeiqiBoard();
private:
TAdjacentInformation GetAdjacentInformation( int X, int Y ) const;
TBlock * AddToNewBlock( TAdjacentInformation ai );
TBlock * AddToExistedBlock( TAdjacentInformation ai, TBlock *pAdjBlock );
TBlock * MergeBlocks( TBlock *pAdjBlock1, TBlock *pAdjBlock2 );
int UpdateBreath( TBlock *pBlock );
bool UpdateBreath();
public:
bool IsRaiding( TWhichSide WhichSide, int X, int Y );
bool CanKillSomeStones( TWhichSide WhichSide, int X, int Y );
bool IsForbiddenMove( TWhichSide WhichSide, int X, int Y );
bool InsertStone( TWhichSide WhichSide, int X, int Y );
bool RemoveDeadStones( TWhichSide WhichSide );
bool UpdateSituationTree( int X, int Y );
TBlock * SearchAdjacentBlock( int X, int Y, TAdjacentDirection ad ) const;
public:
bool UpdateMemoTip( int X, int Y );
};
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -