void gen_mov_64(x86_immediate_operand const & imm, x86_memory_operand const & mem)
 {
     GEN_CODE(MOVQim(imm.value, mem.MD, mem.MB, mem.MI, mem.MS));
 }
 void gen_rotshi_64(int op, int s, int d)
 {
     GEN_CODE(_ROTSHIQrr(op, s, d));
 }
 void gen_mov_64(int s, x86_memory_operand const & mem)
 {
     GEN_CODE(MOVQrm(s, mem.MD, mem.MB, mem.MI, mem.MS));
 }
 void gen_mov_64(x86_immediate_operand const & imm, int d)
 {
     GEN_CODE(MOVQir(imm.value, d));
 }
 void gen_mov_64(int s, int d)
 {
     GEN_CODE(MOVQrr(s, d));
 }
 void gen_mov_64(x86_memory_operand const & mem, int d)
 {
     GEN_CODE(MOVQmr(mem.MD, mem.MB, mem.MI, mem.MS, d));
 }
 void gen_bswap_64(int r)
 {
     GEN_CODE(BSWAPQr(r));
 }
 void gen_rotshi_64(int op, x86_immediate_operand const & imm, int d)
 {
     GEN_CODE(_ROTSHIQir(op, imm.value, d));
 }
 void gen_pop(int r)
 {
     GEN_CODE(POPQr(r));
 }
 void gen_pop(x86_memory_operand const & mem)
 {
     GEN_CODE(POPQm(mem.MD, mem.MB, mem.MI, mem.MS));
 }
 void gen_push(x86_memory_operand const & mem)
 {
     GEN_CODE(PUSHQm(mem.MD, mem.MB, mem.MI, mem.MS));
 }
 void gen_push(int r)
 {
     GEN_CODE(PUSHQr(r));
 }
 void gen_rotshi_64(int op, x86_immediate_operand const & imm, x86_memory_operand const & mem)
 {
     GEN_CODE(_ROTSHIQim(op, imm.value, mem.MD, mem.MB, mem.MI, mem.MS));
 }
Exemple #14
0
#endif
};
typedef struct CodeCheck CodeCheck;

/* 文字コード判定の初期状態. */
#ifndef TEST
#define GEN_CODE(name) \
  { cc_##name, (const unsigned char*)map_##name, (const unsigned char*)map_##name, }
#else
#define GEN_CODE(name) \
  { cc_##name, (const unsigned char*)map_##name, (const unsigned char*)map_##name, mode_##name, }
#endif
#define cc_tmpl_max 13
const CodeCheck cc_tmpl[cc_tmpl_max] = 
{
  GEN_CODE(utf32_be),
  GEN_CODE(utf32_le),
  GEN_CODE(ascii),
  GEN_CODE(jis),
  GEN_CODE(jis_au),
  GEN_CODE(jis_jsky),
  GEN_CODE(eucjp),
  GEN_CODE(sjis),
  GEN_CODE(sjis_jsky),
  GEN_CODE(sjis_imode),
  GEN_CODE(sjis_au),
  GEN_CODE(sjis_doti),
  GEN_CODE(utf8),
};

/* 判定結果の構造体. */
 void gen_lea_64(x86_memory_operand const & mem, int d)
 {
     GEN_CODE(LEAQmr(mem.MD, mem.MB, mem.MI, mem.MS, d));
 }
Exemple #16
0
void init(OptionsMap& o) {

  o["Write Debug Log"]             = Option(false, on_logger);
  o["Write Search Log"]            = Option(false);
  o["Search Log Filename"]         = Option("SearchLog.txt");
  o["Book File"]                   = Option("book.bin");
  o["Best Book Move"]              = Option(false);
  o["Contempt Factor"]             = Option(0, -50,  50);
  o["Mobility (Midgame)"]          = Option(100, 0, 200, on_eval);
  o["Mobility (Endgame)"]          = Option(100, 0, 200, on_eval);
  o["Pawn Structure (Midgame)"]    = Option(100, 0, 200, on_eval);
  o["Pawn Structure (Endgame)"]    = Option(100, 0, 200, on_eval);
  o["Passed Pawns (Midgame)"]      = Option(100, 0, 200, on_eval);
  o["Passed Pawns (Endgame)"]      = Option(100, 0, 200, on_eval);
  o["Space"]                       = Option(100, 0, 200, on_eval);
  o["Aggressiveness"]              = Option(100, 0, 200, on_eval);
  o["Cowardice"]                   = Option(100, 0, 200, on_eval);
  o["Min Split Depth"]             = Option(0, 0, 12, on_threads);
  o["Max Threads per Split Point"] = Option(5, 4,  8, on_threads);
  o["Threads"]                     = Option(1, 1, MAX_THREADS, on_threads);
  o["Idle Threads Sleep"]          = Option(true);
  o["Hash"]                        = Option(128, 1, 8192, on_hash_size);
  o["Clear Hash"]                  = Option(on_clear_hash);
  o["Ponder"]                      = Option(true);
  o["OwnBook"]                     = Option(false);
  o["MultiPV"]                     = Option(1, 1, 500);
  o["Skill Level"]                 = Option(20, 0, 20);
  o["Emergency Move Horizon"]      = Option(40, 0, 50);
  o["Emergency Base Time"]         = Option(50, 0, 30000);
  o["Emergency Move Time"]         = Option(20, 0, 5000);
  o["Minimum Thinking Time"]       = Option(20, 0, 5000);
  o["Slow Mover"]                  = Option(50, 10, 1000);
  o["UCI_Chess960"]                = Option(false);
  o["UCI_AnalyseMode"]             = Option(false, on_eval);
  o["Piece Structure"]             = Option(100, 0, 200, on_eval);

  typedef Value V;
#define S(mg, eg) make_score(mg, eg)

  //用于产生tuner文件
  //Log log;

  //log<<"name,   init,  max,  min,  c_end,  r_end,  elod"<<std::endl;

  //PAWN, BISHOP, ADVISOR, KNIGHT, CANNON, ROOK, KING
  const Score MobilityBonus[][32] = {
	  {}, {},//Pawn
	  { S( 0, 0), S( 0,  0 ), S( 0,  0), S(0, 0),   S(0, 0)},// Bishops
	  { S( 0, 0), S( 0,  0 ), S( 0,  0), S(0, 0),   S(0, 0)},// Advisor
	  { S(-35,-30), S(-20,-20), S(-20,-20), S( 0,  0), S(0, 0), S(15, 10),S( 15, 10), S( 25, 12), S(25, 12) },//knight
	  { S( -10, -10), S( 2,  4), S( 4,  4), S(6, 6), S(8, 8),S(10, 10),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12),S(12, 12)},// Cannon
	  { S(-20,-20), S(-18,-18), S(-16,-16), S( -10,-10), S( -8,-8), S(-4,-4),S( 0, 0), S( 4, 2), S(8, 4), S(12,6), S(16,8), S(20,10),S( 24,12), S( 24,12), S(24,12), S(24,12), S(24,12), S(24,12)}, // Rooks 
  };
  for (int pt1 = KNIGHT; pt1 <= ROOK; ++pt1)
  {
	  for (int c = 0; c <= 17; ++c)
	  {

		  int min = -40;
		  int max = 40;

		  if (pt1 == KNIGHT)
		  {
              min = -50;
			  max = 50;
		  }
		  if (pt1 == CANNON)
		  {
			  min = 0;
			  max = 20;
		  }
		  if (pt1 == ROOK)
		  {
			  min = -30;
			  max = 30;
		  }

		  int m = (int)mg_value(MobilityBonus[pt1][c]);
		  int e = (int)eg_value(MobilityBonus[pt1][c]);


		  char buf[256] = {0};
		  char text[1024]={0};

		  sprintf(buf, "MobilityBonusM[%d][%d]",pt1,c);
		  o[buf] = Option(m, min, max, on_eval_variables);

		  //sprintf(text, "%s,%d,%d,%d,%d,%d,%d",buf, m, max,min,8, 1, 0);
		  //log<<text<<std::endl;

		  //------

		  sprintf(buf, "MobilityBonusE[%d][%d]",pt1,c);
		  o[buf] = Option(e, min, max, on_eval_variables);		  

		  //sprintf(text, "%s,%d,%d,%d,%d,%d,%d",buf, e, max,min,8, 1, 0);
		  //log<<text<<std::endl;

	  }
  }



  const Score RookPin          = make_score(26, 31);
  const Score CannonPin        = make_score(16, 11);

  const Score RookOnPawn       = make_score(10, 28);
  const Score RookOpenFile     = make_score(53, 21);

  const Score RookPinRook      = make_score(20, 20);

  const Score CannonPinRook    = make_score(10, 10);
  const Score CannonPinKnight  = make_score(10, 10);
  const Score CannonPinBishop  = make_score(5, 3);

  const Score KnightLegPawn    = make_score(16,  0);

  {
	  char buf[256] = {0};
	  char text[1024]={0};

	  int min = -50;
	  int max = 50;

	  int m = 0;
	  int e = 0;

#define GEN_CODE(namem,namee, v, minv, maxv) {\
	  m = (int)mg_value((v));\
	  e = (int)eg_value((v));\
      min = minv;\
      max = maxv;\
	  o[namem]= Option(m, min, max, on_eval_variables);\
	  o[namee]= Option(e, min, max, on_eval_variables);\
	  }
	  //sprintf(text, "%s,%d,%d,%d,%d,%d,%d",(namem), m, max,min,8, 1, 0);\
	  //log<<text<<std::endl;\
	  //sprintf(text, "%s,%d,%d,%d,%d,%d,%d",(namee), e, max,min,8, 1, 0);\
	  //log<<text<<std::endl;\
	  }

	  GEN_CODE("RookPinM","RookPinE", RookPin, 0, 50);
	  GEN_CODE("CannonPinM","CannonPinE", CannonPin, 0, 50);
	  GEN_CODE("RookOnPawnM","RookOnPawnE", RookOnPawn, 0, 50);
	  GEN_CODE("RookOpenFileM","RookOpenFileE", RookOpenFile, 0, 50);
	  GEN_CODE("RookPinRookM","RookPinRookE", RookPinRook, 0, 50);
	  GEN_CODE("CannonPinRookM","CannonPinRookE", CannonPinRook, 0, 50);
	  GEN_CODE("CannonPinKnightM","CannonPinKnightE", CannonPinKnight, 0, 50);
	  GEN_CODE("CannonPinBishopM","CannonPinBishopE", CannonPinBishop, 0, 50);
	  GEN_CODE("KnightLegPawnM","KnightLegPawnE", KnightLegPawn, 0, 50);


  }
 void gen_rotshi_64(int op, int s, x86_memory_operand const & mem)
 {
     GEN_CODE(_ROTSHIQrm(op, s, mem.MD, mem.MB, mem.MI, mem.MS));
 }