This commit is contained in:
parent
959ecdeb7d
commit
0145664567
@ -11,26 +11,26 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
std::string pos =
|
// std::string pos =
|
||||||
"r2qkb1r/2p1pppp/p1n1b3/1p6/B2P4/2P1P3/P4PPP/R1BQK1NR w KQkq - 0 9 ";
|
// "r2qkb1r/2p1pppp/p1n1b3/1p6/B2P4/2P1P3/P4PPP/R1BQK1NR w KQkq - 0 9 ";
|
||||||
// std::string pos = "8/6K1/5P2/8/1k6/8/8/8 w - - 0 1";
|
// std::string pos = "8/6K1/5P2/8/1k6/8/8/8 w - - 0 1";
|
||||||
|
|
||||||
// pos for ai timing<
|
// pos for ai timing<
|
||||||
// std::string pos =
|
std::string pos =
|
||||||
// "r3k2r/p1ppqpb1/Bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPB1PPP/R3K2R b KQkq -
|
"r3k2r/p1ppqpb1/Bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPB1PPP/R3K2R b KQkq - 0 3";
|
||||||
// 0 3 ";
|
|
||||||
|
|
||||||
Board b = Board::setup_fen_position(pos);
|
Board b = Board::setup_fen_position(pos);
|
||||||
|
|
||||||
ai::v0_random p1(true, std::chrono::milliseconds(1000));
|
ai::v0_random p1(true, std::chrono::milliseconds(1000));
|
||||||
// ai::v1_pure_minimax p2(false, std::chrono::milliseconds(20000));
|
// ai::v1_pure_minimax p2(false, std::chrono::milliseconds(20000));
|
||||||
// ai::v2_alpha_beta p2(false, std::chrono::milliseconds(20000));
|
// ai::v2_alpha_beta p2(false, std::chrono::milliseconds(20000));
|
||||||
// ai::v3_AB_ordering p2(false, std::chrono::milliseconds(20000));
|
ai::v3_AB_ordering p2(false, std::chrono::milliseconds(20000));
|
||||||
ai::v4_search_captures p2(false, std::chrono::milliseconds(20000));
|
// ai::v4_search_captures p2(false, std::chrono::milliseconds(20000));
|
||||||
|
|
||||||
GUI gui;
|
// GUI gui;
|
||||||
// AIvsAIController manual(b, gui, p1, p2);
|
NoOpView gui;
|
||||||
HumanVsAIController manual(b, gui, p2);
|
AIvsAIController manual(b, gui, p1, p2);
|
||||||
|
// HumanVsAIController manual(b, gui, p2);
|
||||||
|
|
||||||
Controller& controller = manual;
|
Controller& controller = manual;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define MULTITHREADED 1
|
#define MULTITHREADED 1
|
||||||
|
|
||||||
static int position_counter;
|
static int position_counter = 0;
|
||||||
|
|
||||||
Move ai::v1_pure_minimax::_search(const Board& b) {
|
Move ai::v1_pure_minimax::_search(const Board& b) {
|
||||||
position_counter = 0;
|
position_counter = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#define MULTITHREADED 1
|
#define MULTITHREADED 1
|
||||||
|
|
||||||
|
|
||||||
static int position_counter;
|
static int position_counter = 0;
|
||||||
|
|
||||||
Move ai::v2_alpha_beta::_search(const Board& b) {
|
Move ai::v2_alpha_beta::_search(const Board& b) {
|
||||||
position_counter = 0;
|
position_counter = 0;
|
||||||
@ -69,7 +69,6 @@ int ai::v2_alpha_beta::_search(const Board& b, int depth, int alpha, int beta) {
|
|||||||
|
|
||||||
std::vector<Move> moves = b.all_legal_moves();
|
std::vector<Move> moves = b.all_legal_moves();
|
||||||
|
|
||||||
Move best_move;
|
|
||||||
for (const Move& move : moves) {
|
for (const Move& move : moves) {
|
||||||
Board tmp_board = b.make_move(move);
|
Board tmp_board = b.make_move(move);
|
||||||
int tmp_eval = -_search(tmp_board, depth - 1, -beta, -alpha);
|
int tmp_eval = -_search(tmp_board, depth - 1, -beta, -alpha);
|
||||||
|
@ -9,4 +9,8 @@ class NoOpView : public View {
|
|||||||
void update_board(const Board&, int8_t, std::vector<int8_t>) override {};
|
void update_board(const Board&, int8_t, std::vector<int8_t>) override {};
|
||||||
void notify_checkmate(Colour) override{};
|
void notify_checkmate(Colour) override{};
|
||||||
void notify_stalemate(Colour) override{};
|
void notify_stalemate(Colour) override{};
|
||||||
|
|
||||||
|
Piece ask_about_promotion() override {
|
||||||
|
return Queen;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user