static void uci_handle_command(char *command) {
  if(strncasecmp(command, "ucinewgame", 10) == 0) return;
  else if(strncasecmp(command, "info", 4) == 0) uci_start();
  else if(strncasecmp(command, "isready", 7) == 0) printf("readyok\n");
  else if(strncasecmp(command, "position", 8) == 0) uci_set_position(command + 9);
  else if(strncasecmp(command, "quit", 4) == 0) quit();
  else if(strncasecmp(command, "go", 2) == 0) uci_go(command + 3);
  else if(strncasecmp(command, "prices", 6) == 0) set_prices(command + 7);
//  else if(strncasecmp(command, "setoption name", 14) == 0) uci_setoption(command + 15);
}
示例#2
0
BOOL test_search()
{

    uci_set_mode();
    uci_isready();
	
	set_hash(512);
	set_own_book(TRUE);

	uci_new_game(position);

	uci_position(position, "position fen rbbqnknr/pppppppp/8/8/8/8/PPPPPPPP/RBBQNKNR w HAha - moves c2c4 c7c5 g1f3 e7e5 b1e4 e8d6 d2d3 d6e4 d3e4 g8e7 c1e3 b7b6 d1d3 c8b7 a1d1 b7c6 g2g4 f7f6 h1g1 h7h5 e3d2 h5g4 g1g4 d8c8 g4g2 c8a6 a2a3 b6b5 c4b5 c6b5 d3e3 d7d6 d1c1 b8c7 h2h4 a6b7 b2b4 c7b6 a3a4 b5a4 b4c5 b6c5 e3d3 a4b5 d3c2 a7a5 d2c3 a8c8 c2b2 b5c6");
	uci_go("go depth 6");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);

	uci_new_game(position);

	uci_setoption("setoption name UCI_Chess960 value true");

	uci_position(position, "position fen qrknrnbb/pppppppp/8/8/8/8/PPPPPPPP/QRKNRNBB w EBeb -");
	uci_go("go depth 6");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);

	uci_new_game(position);
	uci_position(position, "position fen 7k/8/8/7P/4B3/5K2/7P/8 w - - moves");
	uci_go("go depth 12");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	
	return TRUE;
}
示例#3
0
void test_bench()
{

	uci_set_mode();
	uci_isready();

	set_hash(512);
	set_own_book(FALSE);

	uci_new_game(position);

	global_nodes = 0;

	t_chess_time start_time = time_now();

	uci_position(position, "position fen 8/8/8/4k2K/1R3p2/8/6r1/8 w - -");
	uci_go("go depth 20");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	uci_position(position, "position fen 1rq5/p3kp2/2Bp1p2/1P2p1r1/QP3n2/2P5/5PPP/R4RK1 b - -");
	uci_go("go depth 12");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	uci_position(position, "position fen 1NQ5/k1p1p3/7p/pP2P1P1/2P5/2pq4/1n6/6K1 w - -");
	uci_go("go depth 12");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	uci_position(position, "position fen 2kr3r/pp1q1ppp/5n2/1Nb5/2Pp1B2/7Q/P4PPP/1R3RK1 w - -");
	uci_go("go depth 16");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	uci_position(position, "position fen 8/5p2/pk2p3/4P2p/2b1pP1P/P3P2B/8/7K w - -");
	uci_go("go depth 24");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	uci_position(position, "position fen 5rk1/2p4p/2p4r/3P4/4p1b1/1Q2NqPp/PP3P1K/R4R2 b - -");
	uci_go("go depth 16");

	while (uci.engine_state != UCI_ENGINE_WAITING)
		Sleep(1);
	global_nodes += nodes + qnodes;

	t_chess_time end_time = time_now();

	if (end_time > start_time)
		printf(INFO_STRING_PERFT_SPEED, global_nodes, end_time - start_time, 1000 * global_nodes / (end_time - start_time));
	
}