Initial commit
This commit is contained in:
+195
@@ -0,0 +1,195 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef PolicyUnitH
|
||||
#define PolicyUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <system.hpp>
|
||||
#include <vector>
|
||||
|
||||
#define TYPE_P_BET 0
|
||||
#define TYPE_P_CHIP 1
|
||||
|
||||
#define KIND_BET_NOR 0
|
||||
#define KIND_BET_ASK 2
|
||||
#define KIND_BET_DIF 3
|
||||
|
||||
#define KIND_CHIP_NOR 0
|
||||
#define KIND_CHIP_HAN 1
|
||||
#define KIND_CHIP_LEV 2
|
||||
#define KIND_CHIP_COM 3
|
||||
#define KIND_CHIP_WLD 4
|
||||
#define KIND_CHIP_RAN 8
|
||||
//---------------------------------------------------------------------------
|
||||
using namespace std;
|
||||
|
||||
//策略基类
|
||||
class TBaseRow {
|
||||
public:
|
||||
virtual void Clear()=0;
|
||||
// TBaseRow(){Clear();};
|
||||
};
|
||||
|
||||
class TBasePolicy {
|
||||
public:
|
||||
String name;
|
||||
int type; //存储类型 0=内置免费 1=内置付费 2=用户自定义 3=用户定制
|
||||
int id; //唯一ID
|
||||
int kind; //自定义类型 CHIP:0=普通 1=手数层级 2=组合层级 4=随机 ... BET:0=普通 2=庄闲问路 3=庄闲差...
|
||||
bool actived; //是否激活
|
||||
vector<TBaseRow*> aRows;
|
||||
|
||||
virtual void AddNewRow()=0;
|
||||
virtual TBaseRow* ParseRow(char* data, int& err)=0;
|
||||
virtual int ParsePolicy(char* data, int pt);
|
||||
virtual void Clear();
|
||||
virtual void Reset();
|
||||
|
||||
TBasePolicy(){id=type=kind=0;}
|
||||
~TBasePolicy();
|
||||
};
|
||||
|
||||
//打法策略
|
||||
class TBetRow : public TBaseRow {
|
||||
public:
|
||||
vector<int> cond; //切入点匹配,字符串解析为整形保存
|
||||
// item&0x3=颜色 (item&7C)>>2=个数 item&0x80=是否定长
|
||||
// int bet; //下注方向
|
||||
vector<char> bets; //下注项
|
||||
|
||||
virtual void Clear(){
|
||||
cond.clear();
|
||||
bets.clear();
|
||||
};
|
||||
|
||||
// TBetRow(){};//Clear();};
|
||||
};
|
||||
|
||||
class TBetPolicy : public TBasePolicy{
|
||||
public:
|
||||
int road; //适用路单
|
||||
|
||||
TBetPolicy& operator = (const TBetPolicy& b);
|
||||
bool operator == (const TBetPolicy& b);
|
||||
|
||||
virtual void AddNewRow();
|
||||
virtual TBaseRow* ParseRow(char* data, int& err);
|
||||
vector<int> ParseCondition(char* data);
|
||||
static vector<char> ParseBet(char* data);
|
||||
virtual void Reset();
|
||||
|
||||
TBetPolicy(){road=0;}
|
||||
};
|
||||
|
||||
//注码策略
|
||||
class TChipRow : public TBaseRow{
|
||||
public:
|
||||
int iSeq; //序号
|
||||
int chip; //注码/倍数
|
||||
int iWin; //赢走向
|
||||
int iLos; //输走向
|
||||
|
||||
virtual void Clear(){iSeq=chip=iWin=iLos=0;};
|
||||
|
||||
TChipRow(){Clear();};
|
||||
};
|
||||
|
||||
//层级
|
||||
class TTierRow : public TChipRow{
|
||||
public:
|
||||
int hands; //层级注码手数
|
||||
};
|
||||
|
||||
//阶梯
|
||||
class TLevelRow : public TChipRow{
|
||||
public:
|
||||
int nCondWin; //赢走向条件
|
||||
int nCondLos; //输走向条件
|
||||
};
|
||||
|
||||
//组合
|
||||
class TComboRow : public TLevelRow{
|
||||
public:
|
||||
int id; //方案id
|
||||
int iPolicy; //方案序号
|
||||
TComboRow(){id=iPolicy=-1;};
|
||||
};
|
||||
|
||||
////赢输次差
|
||||
//class TWLDiffRow : public TChipRow{
|
||||
//public:
|
||||
// int nMore; //大于数值
|
||||
// int nLess; //少于数值
|
||||
//};
|
||||
|
||||
class TChipPolicy: public TBasePolicy{
|
||||
public:
|
||||
int dead, //爆缆后操作 0=停止 1=新局重启 2=暂停后重启
|
||||
deadPause; //暂停分钟数
|
||||
|
||||
TChipPolicy& operator = (const TChipPolicy& b);
|
||||
bool operator == (const TChipPolicy& b);
|
||||
|
||||
virtual void AddNewRow();
|
||||
virtual TBaseRow* ParseRow(char* data, int& err);
|
||||
|
||||
TChipPolicy(){dead=deadPause=0;}
|
||||
};
|
||||
|
||||
class TTierPolicy: public TChipPolicy{
|
||||
public:
|
||||
bool bTierWinRet,//二层以上赢利回基
|
||||
bTierAccChip, //输额加入下层注码
|
||||
bTierLos0; //输打0
|
||||
|
||||
TTierPolicy(){bTierWinRet=bTierAccChip=bTierLos0=0;}
|
||||
};
|
||||
|
||||
class TLevelPolicy: public TChipPolicy{
|
||||
public:
|
||||
bool bTotalDiff, //总体计算输赢
|
||||
bInstant; //即时跳转
|
||||
|
||||
TLevelPolicy(){bTotalDiff=bInstant=0;}
|
||||
};
|
||||
|
||||
class TWLDiffPolicy: public TLevelPolicy{
|
||||
public:
|
||||
bool bIndie; //各层分别统计
|
||||
TWLDiffPolicy(){bIndie=0;}
|
||||
};
|
||||
|
||||
typedef struct tagRandomChip{
|
||||
int minChip, //最小随机
|
||||
maxChip; //最大随机
|
||||
tagRandomChip(){minChip=20, maxChip=100;}
|
||||
}TRandomChip;
|
||||
|
||||
typedef struct tagBPAskBet{
|
||||
char bet[2]; //庄全红/闲全红 0=不打 1=庄 2=闲
|
||||
tagBPAskBet(){bet[0]=1, bet[1]=2;}
|
||||
}TBPAskBet;
|
||||
|
||||
typedef struct tagBPDiffBet{
|
||||
BYTE diff[2]; //庄闲差 0=庄大 1=闲大
|
||||
// char bet[2]; //庄大/闲大下注 1=庄 2=闲
|
||||
char bets[2][16]; //庄大/闲大下注 1=庄 2=闲
|
||||
tagBPDiffBet(){diff[0]=diff[1]=5, strcpy(bets[0],"a"), strcpy(bets[1],"s");}
|
||||
}TBPDiffBet;
|
||||
|
||||
void __fastcall LoadPolicies();
|
||||
int __fastcall SavePolicy(int type, TBasePolicy* pPolicy, int index);
|
||||
int __fastcall DeletePolicy(int type, int index);
|
||||
int __fastcall MinChipOfPolicy(int index);
|
||||
vector<int> __fastcall PolicyInCombo(int iPolicy);
|
||||
int __fastcall FindPolicy(int type, int id);
|
||||
void __fastcall CheckComboRow(TComboRow* row);
|
||||
|
||||
extern vector<TBasePolicy*> g_aBetPolicies;
|
||||
extern vector<TBasePolicy*> g_aChipPolicies;
|
||||
extern int g_iBetPolicy; //全局打法
|
||||
extern int g_iChipPolicy;//全局注码
|
||||
extern int g_nChipMul; //全局注码倍数
|
||||
extern TRandomChip g_RandomChip;
|
||||
extern TBPAskBet g_BPAskBet;
|
||||
extern TBPDiffBet g_BPDiffBet;
|
||||
#endif
|
||||
Reference in New Issue
Block a user