281 lines
11 KiB
C++
281 lines
11 KiB
C++
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
|
|
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
|
|
|
|
#include "../inst/include/Rchess.h"
|
|
#include <Rcpp.h>
|
|
|
|
using namespace Rcpp;
|
|
|
|
#ifdef RCPP_USE_GLOBAL_ROSTREAM
|
|
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
|
|
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
|
|
#endif
|
|
|
|
// HCE
|
|
Rcpp::NumericVector HCE(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_HCE(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(HCE(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// isWhiteTurn
|
|
Rcpp::LogicalVector isWhiteTurn(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_isWhiteTurn(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(isWhiteTurn(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// isCheck
|
|
Rcpp::LogicalVector isCheck(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_isCheck(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(isCheck(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// isQuiet
|
|
Rcpp::LogicalVector isQuiet(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_isQuiet(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(isQuiet(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// isTerminal
|
|
Rcpp::LogicalVector isTerminal(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_isTerminal(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(isTerminal(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// isInsufficient
|
|
Rcpp::LogicalVector isInsufficient(const std::vector<Board>& positions);
|
|
RcppExport SEXP _Rchess_isInsufficient(SEXP positionsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(isInsufficient(positions));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// data_gen
|
|
Rcpp::CharacterVector data_gen(const std::string& file, const int sample_size, const float score_min, const float score_max, const bool quiet, const int min_ply_count, const bool white_only);
|
|
RcppExport SEXP _Rchess_data_gen(SEXP fileSEXP, SEXP sample_sizeSEXP, SEXP score_minSEXP, SEXP score_maxSEXP, SEXP quietSEXP, SEXP min_ply_countSEXP, SEXP white_onlySEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::RNGScope rcpp_rngScope_gen;
|
|
Rcpp::traits::input_parameter< const std::string& >::type file(fileSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type sample_size(sample_sizeSEXP);
|
|
Rcpp::traits::input_parameter< const float >::type score_min(score_minSEXP);
|
|
Rcpp::traits::input_parameter< const float >::type score_max(score_maxSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type quiet(quietSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type min_ply_count(min_ply_countSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type white_only(white_onlySEXP);
|
|
rcpp_result_gen = Rcpp::wrap(data_gen(file, sample_size, score_min, score_max, quiet, min_ply_count, white_only));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// eval_psqt
|
|
Rcpp::NumericVector eval_psqt(const std::vector<Board>& positions, const std::vector<Rcpp::NumericMatrix>& psqt, const bool pawn_structure, const bool eval_rooks, const bool eval_king);
|
|
RcppExport SEXP _Rchess_eval_psqt(SEXP positionsSEXP, SEXP psqtSEXP, SEXP pawn_structureSEXP, SEXP eval_rooksSEXP, SEXP eval_kingSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type positions(positionsSEXP);
|
|
Rcpp::traits::input_parameter< const std::vector<Rcpp::NumericMatrix>& >::type psqt(psqtSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type pawn_structure(pawn_structureSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type eval_rooks(eval_rooksSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type eval_king(eval_kingSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(eval_psqt(positions, psqt, pawn_structure, eval_rooks, eval_king));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// fen2int
|
|
Rcpp::IntegerVector fen2int(const std::vector<Board>& boards);
|
|
RcppExport SEXP _Rchess_fen2int(SEXP boardsSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::vector<Board>& >::type boards(boardsSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(fen2int(boards));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// read_cyclic
|
|
Rcpp::CharacterVector read_cyclic(const std::string& file, const int nrows, const int skip, const int start, const int line_len);
|
|
RcppExport SEXP _Rchess_read_cyclic(SEXP fileSEXP, SEXP nrowsSEXP, SEXP skipSEXP, SEXP startSEXP, SEXP line_lenSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::string& >::type file(fileSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type nrows(nrowsSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type skip(skipSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type start(startSEXP);
|
|
Rcpp::traits::input_parameter< const int >::type line_len(line_lenSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(read_cyclic(file, nrows, skip, start, line_len));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// sample_move
|
|
Move sample_move(const Board& pos);
|
|
RcppExport SEXP _Rchess_sample_move(SEXP posSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::RNGScope rcpp_rngScope_gen;
|
|
Rcpp::traits::input_parameter< const Board& >::type pos(posSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(sample_move(pos));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// sample_fen
|
|
std::vector<Board> sample_fen(const unsigned nr, const unsigned min_depth, const unsigned max_depth);
|
|
RcppExport SEXP _Rchess_sample_fen(SEXP nrSEXP, SEXP min_depthSEXP, SEXP max_depthSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::RNGScope rcpp_rngScope_gen;
|
|
Rcpp::traits::input_parameter< const unsigned >::type nr(nrSEXP);
|
|
Rcpp::traits::input_parameter< const unsigned >::type min_depth(min_depthSEXP);
|
|
Rcpp::traits::input_parameter< const unsigned >::type max_depth(max_depthSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(sample_fen(nr, min_depth, max_depth));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// board
|
|
Board board(const std::string& fen);
|
|
RcppExport SEXP _Rchess_board(SEXP fenSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const std::string& >::type fen(fenSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(board(fen));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// print_board
|
|
void print_board(const std::string& fen);
|
|
RcppExport SEXP _Rchess_print_board(SEXP fenSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::traits::input_parameter< const std::string& >::type fen(fenSEXP);
|
|
print_board(fen);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// print_moves
|
|
void print_moves(const std::string& fen);
|
|
RcppExport SEXP _Rchess_print_moves(SEXP fenSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::traits::input_parameter< const std::string& >::type fen(fenSEXP);
|
|
print_moves(fen);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// print_bitboards
|
|
void print_bitboards(const std::string& fen);
|
|
RcppExport SEXP _Rchess_print_bitboards(SEXP fenSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::traits::input_parameter< const std::string& >::type fen(fenSEXP);
|
|
print_bitboards(fen);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// position
|
|
Board position(const Board& pos, const std::vector<std::string>& moves, const bool san);
|
|
RcppExport SEXP _Rchess_position(SEXP posSEXP, SEXP movesSEXP, SEXP sanSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const Board& >::type pos(posSEXP);
|
|
Rcpp::traits::input_parameter< const std::vector<std::string>& >::type moves(movesSEXP);
|
|
Rcpp::traits::input_parameter< const bool >::type san(sanSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(position(pos, moves, san));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// perft
|
|
void perft(const int depth);
|
|
RcppExport SEXP _Rchess_perft(SEXP depthSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::traits::input_parameter< const int >::type depth(depthSEXP);
|
|
perft(depth);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// go
|
|
Move go(const int depth);
|
|
RcppExport SEXP _Rchess_go(SEXP depthSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RObject rcpp_result_gen;
|
|
Rcpp::traits::input_parameter< const int >::type depth(depthSEXP);
|
|
rcpp_result_gen = Rcpp::wrap(go(depth));
|
|
return rcpp_result_gen;
|
|
END_RCPP
|
|
}
|
|
// ucinewgame
|
|
void ucinewgame();
|
|
RcppExport SEXP _Rchess_ucinewgame() {
|
|
BEGIN_RCPP
|
|
ucinewgame();
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// onLoad
|
|
void onLoad(const std::string& libname, const std::string& pkgname);
|
|
RcppExport SEXP _Rchess_onLoad(SEXP libnameSEXP, SEXP pkgnameSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RNGScope rcpp_rngScope_gen;
|
|
Rcpp::traits::input_parameter< const std::string& >::type libname(libnameSEXP);
|
|
Rcpp::traits::input_parameter< const std::string& >::type pkgname(pkgnameSEXP);
|
|
onLoad(libname, pkgname);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
// onUnload
|
|
void onUnload(const std::string& libpath);
|
|
RcppExport SEXP _Rchess_onUnload(SEXP libpathSEXP) {
|
|
BEGIN_RCPP
|
|
Rcpp::RNGScope rcpp_rngScope_gen;
|
|
Rcpp::traits::input_parameter< const std::string& >::type libpath(libpathSEXP);
|
|
onUnload(libpath);
|
|
return R_NilValue;
|
|
END_RCPP
|
|
}
|
|
|
|
static const R_CallMethodDef CallEntries[] = {
|
|
{"_Rchess_HCE", (DL_FUNC) &_Rchess_HCE, 1},
|
|
{"_Rchess_isWhiteTurn", (DL_FUNC) &_Rchess_isWhiteTurn, 1},
|
|
{"_Rchess_isCheck", (DL_FUNC) &_Rchess_isCheck, 1},
|
|
{"_Rchess_isQuiet", (DL_FUNC) &_Rchess_isQuiet, 1},
|
|
{"_Rchess_isTerminal", (DL_FUNC) &_Rchess_isTerminal, 1},
|
|
{"_Rchess_isInsufficient", (DL_FUNC) &_Rchess_isInsufficient, 1},
|
|
{"_Rchess_data_gen", (DL_FUNC) &_Rchess_data_gen, 7},
|
|
{"_Rchess_eval_psqt", (DL_FUNC) &_Rchess_eval_psqt, 5},
|
|
{"_Rchess_fen2int", (DL_FUNC) &_Rchess_fen2int, 1},
|
|
{"_Rchess_read_cyclic", (DL_FUNC) &_Rchess_read_cyclic, 5},
|
|
{"_Rchess_sample_move", (DL_FUNC) &_Rchess_sample_move, 1},
|
|
{"_Rchess_sample_fen", (DL_FUNC) &_Rchess_sample_fen, 3},
|
|
{"_Rchess_board", (DL_FUNC) &_Rchess_board, 1},
|
|
{"_Rchess_print_board", (DL_FUNC) &_Rchess_print_board, 1},
|
|
{"_Rchess_print_moves", (DL_FUNC) &_Rchess_print_moves, 1},
|
|
{"_Rchess_print_bitboards", (DL_FUNC) &_Rchess_print_bitboards, 1},
|
|
{"_Rchess_position", (DL_FUNC) &_Rchess_position, 3},
|
|
{"_Rchess_perft", (DL_FUNC) &_Rchess_perft, 1},
|
|
{"_Rchess_go", (DL_FUNC) &_Rchess_go, 1},
|
|
{"_Rchess_ucinewgame", (DL_FUNC) &_Rchess_ucinewgame, 0},
|
|
{"_Rchess_onLoad", (DL_FUNC) &_Rchess_onLoad, 2},
|
|
{"_Rchess_onUnload", (DL_FUNC) &_Rchess_onUnload, 1},
|
|
{NULL, NULL, 0}
|
|
};
|
|
|
|
RcppExport void R_init_Rchess(DllInfo *dll) {
|
|
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
|
|
R_useDynamicSymbols(dll, FALSE);
|
|
}
|