示例#1
0
int main()
{
	int ctime = Bench(foutC);
	int cpptime = Bench(foutCPP);
	int upptime = Bench(foutUPP);

	std::cout << "Output:\n";
	std::cout << "C: " << ctime << " C++: " << cpptime << " U++: " << upptime << "\n";
	std::cout << "C++/C " << static_cast<double>( cpptime ) / ctime << "\n";
	std::cout << "U++/C " << static_cast<double>( upptime ) / ctime << "\n";

	ctime = Bench(ffoutC);
	cpptime = Bench(ffoutCPP);
	upptime = Bench(ffoutUPP);
	int upp2time = Bench(ffoutUPP2);

	std::cout << "Formatted Output:\n";
	std::cout << "C: " << ctime << " C++: " << cpptime << " U++: " << upptime << " U++ Format: " << upp2time << "\n";
	std::cout << "C++/C " << static_cast<double>( cpptime ) / ctime << "\n";
	std::cout << "U++/C " << static_cast<double>( upptime ) / ctime << "\n";
	std::cout << "U++Format/C " << static_cast<double>( upp2time ) / ctime << "\n";

	ctime = Bench(finC);
	cpptime = Bench(finCPP);
	upptime = Bench(finUPP);

	std::cout << "\nInput:\n";
	std::cout << "C: " << ctime << " C++: " << cpptime << " U++: " << upptime << "\n";
	std::cout << "C++/C " << static_cast<double>( cpptime ) / ctime << "\n";
	std::cout << "U++/C " << static_cast<double>( upptime ) / ctime << "\n";
}
示例#2
0
HRESULT BenchCon(DECL_EXTERNAL_CODECS_LOC_VARS
    const CObjectVector<CProperty> &props, UInt32 numIterations, FILE *f)
{
  CPrintBenchCallback callback;
  callback._file = f;
  return Bench(EXTERNAL_CODECS_LOC_VARS
      &callback, NULL, props, numIterations, true);
}
示例#3
0
文件: uci.cpp 项目: raimarHD/lcec
void UciLoop(void) {

  char command[4096], token[180], *ptr;
  POS p[1];

  setbuf(stdin, NULL);
  setbuf(stdout, NULL);
  SetPosition(p, START_POS);
  AllocTrans(16);
  for (;;) {
    ReadLine(command, sizeof(command));
    ptr = ParseToken(command, token);

    // checks if Rodent should play with an opening book
    // UseBook remains for backward compatibly
    if ((strstr(command, "setoption name OwnBook value")) || (strstr(command, "setoption name UseBook value")))
      use_book = (strstr(command, "value true") != 0);
    if (strstr(command, "setoption name UCI_LimitStrength value"))
      Param.fl_weakening = (strstr(command, "value true") != 0);

    if (strcmp(token, "uci") == 0) {
      printf("id name %s\n", PROG_NAME);
      printf("id author Pawel Koziol (based on Sungorus 1.4 by Pablo Vazquez)\n");
      printf("option name Hash type spin default 16 min 1 max 4096\n");
      printf("option name Clear Hash type button\n");
      if (panel_style > 0) {
        printf("option name PawnValue type spin default %d min 0 max 1200\n", Param.pc_value[P]);
        printf("option name KnightValue type spin default %d min 0 max 1200\n", Param.pc_value[N]);
        printf("option name BishopValue type spin default %d min 0 max 1200\n", Param.pc_value[B]);
        printf("option name RookValue type spin default %d min 0 max 1200\n", Param.pc_value[R]);
        printf("option name QueenValue type spin default %d min 0 max 1200\n", Param.pc_value[Q]);
        
		printf("option name KeepPawn type spin default %d min -200 max 200\n", Param.keep_pc[P]);
        printf("option name KeepKnight type spin default %d min -200 max 200\n", Param.keep_pc[N]);
        printf("option name KeepBishop type spin default %d min -200 max 200\n", Param.keep_pc[B]);
        printf("option name KeepRook type spin default %d min -200 max 200\n", Param.keep_pc[R]);
        printf("option name KeepQueen type spin default %d min -200 max 200\n", Param.keep_pc[Q]);

        printf("option name BishopPair type spin default %d min -100 max 100\n", Param.bish_pair);
        if (panel_style == 2)
			printf("option name KnightPair type spin default %d min -100 max 100\n", Param.knight_pair);
           printf("option name ExchangeImbalance type spin default %d min -100 max 100\n", Param.exchange_imbalance);
        printf("option name KnightLikesClosed type spin default %d min 0 max 10\n", Param.np_bonus);
        if (panel_style == 2)
           printf("option name RookLikesOpen type spin default %d min 0 max 10\n", Param.rp_malus);

        printf("option name Material type spin default %d min 0 max 500\n", Param.mat_perc);
        printf("option name OwnAttack type spin default %d min 0 max 500\n", dyn_weights[DF_OWN_ATT]);
        printf("option name OppAttack type spin default %d min 0 max 500\n", dyn_weights[DF_OPP_ATT]);
        printf("option name OwnMobility type spin default %d min 0 max 500\n", dyn_weights[DF_OWN_MOB]);
        printf("option name OppMobility type spin default %d min 0 max 500\n", dyn_weights[DF_OPP_MOB]);

        printf("option name KingTropism type spin default %d min -50 max 500\n", weights[F_TROPISM]);
        printf("option name PiecePlacement type spin default %d min 0 max 500\n", Param.pst_perc);
        printf("option name PiecePressure type spin default %d min 0 max 500\n", weights[F_PRESSURE]);
        printf("option name PassedPawns type spin default %d min 0 max 500\n", weights[F_PASSERS]);
        printf("option name PawnStructure type spin default %d min 0 max 500\n", weights[F_PAWNS]);

		printf("option name Outposts type spin default %d min 0 max 500\n", weights[F_OUTPOST]);
        printf("option name Lines type spin default %d min 0 max 500\n", weights[F_LINES]);
        if (panel_style == 2) {
          printf("option name PawnShield type spin default %d min 0 max 500\n", Param.shield_perc);
          printf("option name PawnStorm type spin default %d min 0 max 500\n", Param.storm_perc);
        }
        printf("option name PstStyle type spin default %d min 0 max 2\n", Param.pst_style);
		printf("option name MobilityStyle type spin default %d min 0 max 1\n", Param.mob_style);

        if (panel_style == 2) {
          printf("option name DoubledPawnMg type spin default %d min -100 max 0\n", Param.doubled_malus_mg);
          printf("option name DoubledPawnEg type spin default %d min -100 max 0\n", Param.doubled_malus_eg);
          printf("option name IsolatedPawnMg type spin default %d min -100 max 0\n", Param.isolated_malus_mg);
          printf("option name IsolatedPawnEg type spin default %d min -100 max 0\n", Param.isolated_malus_eg);
          printf("option name IsolatedOnOpenMg type spin default %d min -100 max 0\n", Param.isolated_open_malus);
          printf("option name BackwardPawnMg type spin default %d min -100 max 0\n", Param.backward_malus_base);
          printf("option name BackwardPawnEg type spin default %d min -100 max 0\n", Param.backward_malus_eg);
          printf("option name BackwardOnOpenMg type spin default %d min -100 max 0\n", Param.backward_open_malus);
        }

        // Strength settings - we use either Elo slider with an approximate formula
        // or separate options for nodes per second reduction and eval blur

        if (fl_elo_slider == 0) {
          printf("option name NpsLimit type spin default %d min 0 max 5000000\n", Timer.nps_limit);
          printf("option name EvalBlur type spin default %d min 0 max 5000000\n", Param.eval_blur);
        } else {
          printf("option name UCI_LimitStrength type check default false\n");
          printf("option name UCI_Elo type spin default %d min 800 max 2800\n", Param.elo);
        }

        printf("option name Contempt type spin default %d min -250 max 250\n", Param.draw_score);
        printf("option name SlowMover type spin default %d min 10 max 500\n", time_percentage);
        printf("option name Selectivity type spin default %d min 0 max 200\n", hist_perc);
        printf("option name OwnBook type check default true\n");
        printf("option name GuideBookFile type string default guide.bin\n");
        printf("option name MainBookFile type string default rodent.bin\n");
        printf("option name BookFilter type spin default %d min 0 max 5000000\n", Param.book_filter);
     }

     if (panel_style == 0) {
        printf("option name PersonalityFile type string default rodent.txt\n");
        printf("option name OwnBook type check default true\n");
        if (fl_separate_books) {
          printf("option name GuideBookFile type string default guide.bin\n");
          printf("option name MainBookFile type string default rodent.bin\n");
        }
     }

      printf("uciok\n");
    } else if (strcmp(token, "isready") == 0) {
      printf("readyok\n");
    } else if (strcmp(token, "setoption") == 0) {
      ParseSetoption(ptr);
    } else if (strcmp(token, "position") == 0) {
      ParsePosition(p, ptr);
    } else if (strcmp(token, "perft") == 0) {
      ptr = ParseToken(ptr, token);
    int depth = atoi(token);
    if (depth == 0) depth = 5;
    Timer.SetStartTime();
    nodes = Perft(p, 0, depth);
#if defined _WIN32 || defined _WIN64 
    printf (" perft %d : %I64d nodes in %d miliseconds\n", depth, nodes, Timer.GetElapsedTime() );
#else
    printf(" perft %d : %lld nodes in %d miliseconds\n", depth, nodes, Timer.GetElapsedTime());
#endif
    } else if (strcmp(token, "print") == 0) {
      PrintBoard(p);
    } else if (strcmp(token, "eval") == 0) {
      SetAsymmetricEval(p->side);
      Eval.Print(p);
    } else if (strcmp(token, "step") == 0) {
      ParseMoves(p, ptr);
    } else if (strcmp(token, "go") == 0) {
      ParseGo(p, ptr);
    } else if (strcmp(token, "bench") == 0) {
      ptr = ParseToken(ptr, token);
      Bench(atoi(token));
    } else if (strcmp(token, "quit") == 0) {
      return;
    }
  }
}
示例#4
0
int main(int argc,char **argv)
{
	return Bench(argc,argv);
}