Removed the python version and kept just the c++ one
Some checks failed
pre-release / Pre Release (push) Waiting to run
tagged-release / Tagged Release (push) Has been cancelled

This commit is contained in:
Karma Riuk
2025-02-16 09:36:04 +01:00
parent 0145664567
commit 5cbe57dc55
91 changed files with 29 additions and 1531 deletions

View File

@ -0,0 +1,29 @@
#include "human_vs_ai.hpp"
#include <algorithm>
HumanVsAIController::HumanVsAIController(Board b, View& v, ai::AI& ai)
: ManualController(b, v),
ai(ai) {}
void HumanVsAIController::on_tile_selected(int x, int y) {
Coords c{x, y};
Piece piece = board.piece_at(c);
if (selected_index == -1
|| (piece != Piece::None && piece != selected_piece
&& (piece & 0b11000) != (selected_piece & 0b11000))) {
show_legal_moves(c);
} else {
auto boh = std::find(targets.begin(), targets.end(), c.to_index());
if (boh != targets.end()) {
make_move(Move{selected_index, c.to_index()});
if (board.is_terminal())
return;
Move ai_move = ai.search(board);
make_move(ai_move);
} else
reset_selection();
}
}