sd.h
- Code: Select all
#ifndef __sd_h__
#define __sd_h__
typedef unsigned char byte;
typedef unsigned short word;
#define TimeBackground 0.000001396825 //背景时耗
#define TotalBoard 30000 //总局数
//解的性质
#define NoAnswer 0
#define UniqAnswer 1
#define MoreAnswer 2
//高ä¸ä½Ž9ä½
#define HIGH_9_BIT(v) (v) >> 18
#define MID_9_BIT(v) ((v) >> 9) & 0x1FF
#define LOW_9_BIT(v) (v) & 0x1FF
#define HML_9_BIT(v, l) (v) >> TblMult9[l] & 0x1FF
#define FULL_TO_COLUMN(v) ((v) | ((v) >> 9) | ((v) >> 18)) & 0x1FF //完全掩ç 转æ¢ä¸ºåˆ—掩ç
#define FULL_TO_PALACE(v) ((v) | ((v) >> 6) | ((v) >> 12)) & 0x1FF //完全掩ç 转æ¢ä¸ºå®«æŽ©ç
#define BIT_SET_27 0x07FFFFFF
#define AN(v, n) (v) &= ~(n)
struct CGame {
public:
int Finish; //完æˆä½å›¾
int F[27]; //完全掩ç
byte U[28]; //å•æ ¼å·²å”¯ä¸€
byte Block; //猜测的区å·
byte Line; //猜测的行å·
word Mask; //猜测的ç€æ³•
word Left; //剩余的ç€æ³•
};
//通用表
extern int TblMult3[81];
extern int TblDivide3[81];
extern int TblRmder3[81];
extern int TblMult9[9];
//基础表
extern int TblCombineMask[512];
extern int TblTailZero[512];
extern int TblNumberOne[512];
extern int TblAnother1[27];
extern int TblAnother2[27];
extern int TblShiftLeft[27];
//盘é¢åˆ†è§£
extern int TblBoard_Palace[81];
extern int TblBoard_Block[81];
extern int TblBoard_BlockMask[81];
extern int TblBoard_GridUniq[81];
//创建用表
extern int TblSelfMask[81];
extern int TblOtherMask[81];
//å•è¡ŒæŽ’除
extern int TblSingleRow[12];
extern int TblPalace_Row[512];
//å•åŒåˆ—排除
extern int TblMaskSingle[512];
extern int TblMaskDouble[512];
//唯一行排除
extern int TblConfirmRow[12];
//其他表
extern int TblPalaceMask[3];
extern int TblStrange[27];
extern int TblChangeMask[27];
extern bool TblUniqFlag[8];
extern void CreateTable();
#endif