Exemple #1
0
// fast initialization steps that can be done in main thread
void InitializeFast()
{
	std::cout << "# Using " << omp_get_max_threads() << " OpenMP thread(s)" << std::endl;

	GetVersion();

#ifdef DEBUG
	std::cout << "# Running in debug mode" << std::endl;
#else
	std::cout << "# Running in release mode" << std::endl;
#endif

	Eigen::initParallel();

	// set Eigen to use 1 thread because we are doing OpenMP here
	Eigen::setNbThreads(1);

	// disable nested parallelism since we don't need it, and disabling it
	// makes managing number of threads easier
	omp_set_nested(0);

	// turn off IO buffering
	std::cout.setf(std::ios::unitbuf);

	initmagicmoves();
	BoardConstsInit();
	InitializeZobrist();
}
Exemple #2
0
LUALIB_API int luaopen_chess_attack(lua_State *L) {
    initmagicmoves();
    luaL_register(L, "chess.attack", attack_global);

    /* Push colours */
    lua_pushliteral(L, "WHITE");
    lua_pushinteger(L, WHITE);
    lua_settable(L, -3);

    lua_pushliteral(L, "BLACK");
    lua_pushinteger(L, BLACK);
    lua_settable(L, -3);

    lua_pushliteral(L, "NOCOLOUR");
    lua_pushinteger(L, NOCOLOUR);
    lua_settable(L, -3);

    /* Push pieces */
    lua_pushliteral(L, "PAWN");
    lua_pushinteger(L, PAWN);
    lua_settable(L, -3);

    lua_pushliteral(L, "KNIGHT");
    lua_pushinteger(L, KNIGHT);
    lua_settable(L, -3);

    lua_pushliteral(L, "BISHOP");
    lua_pushinteger(L, BISHOP);
    lua_settable(L, -3);

    lua_pushliteral(L, "ROOK");
    lua_pushinteger(L, ROOK);
    lua_settable(L, -3);

    lua_pushliteral(L, "QUEEN");
    lua_pushinteger(L, QUEEN);
    lua_settable(L, -3);

    lua_pushliteral(L, "KING");
    lua_pushinteger(L, KING);
    lua_settable(L, -3);

    return 1;
}
void initMagics()
{
    initmagicmoves();
}
Exemple #4
0
void movegen_init(void) {
    init_movegen_kings();
    init_movegen_knights();
    init_movegen_pawns();
    initmagicmoves();
}