big refactoring: put everything in model to allow
for better mvc structure (yes i'm doing view in cpp)
This commit is contained in:
parent
1231e4da92
commit
72f3431418
@ -1,4 +1,6 @@
|
|||||||
#include "ais/ai.hpp"
|
#include "model/ais/ai.hpp"
|
||||||
|
#include "model/board/board.hpp"
|
||||||
|
#include "model/perft/perft.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -6,9 +8,11 @@ int main(int argc, char* argv[]) {
|
|||||||
std::string pos =
|
std::string pos =
|
||||||
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
|
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
|
||||||
|
|
||||||
ai::v1_simple ai;
|
perft();
|
||||||
|
// ai::v1_simple ai;
|
||||||
std::string move = ai.search(pos, 4);
|
//
|
||||||
std::cout << move << std::endl;
|
// Board b = Board::setup_fen_position(pos);
|
||||||
|
// Move move = ai.search(b, true);
|
||||||
|
// std::cout << move << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
#include "../pieces/piece.hpp"
|
#include "../pieces/piece.hpp"
|
||||||
#include "../threadpool.hpp"
|
#include "../utils/threadpool.hpp"
|
||||||
#include "ai.hpp"
|
#include "ai.hpp"
|
||||||
|
|
||||||
#include <future>
|
#include <future>
|
@ -1,8 +1,8 @@
|
|||||||
#include "board.hpp"
|
#include "board.hpp"
|
||||||
|
|
||||||
#include "coords.hpp"
|
#include "../pieces/piece.hpp"
|
||||||
#include "move.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "pieces/piece.hpp"
|
#include "../utils/move.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "coords.hpp"
|
#include "../pieces/piece.hpp"
|
||||||
#include "move.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "pieces/piece.hpp"
|
#include "../utils/move.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
#include "perft.hpp"
|
#include "perft.hpp"
|
||||||
|
|
||||||
#include "board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "threadpool.hpp"
|
#include "../utils/threadpool.hpp"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <map>
|
#include <map>
|
@ -1,6 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "../move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
@ -1,5 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
static bool is_clear_king_side(const Board& b, const Coords xy) {
|
static bool is_clear_king_side(const Board& b, const Coords xy) {
|
@ -1,6 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "../move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
@ -1,6 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "../move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
||||||
@ -16,12 +16,11 @@ std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
|||||||
if (my_colour != b.colour_at(left))
|
if (my_colour != b.colour_at(left))
|
||||||
if ((my_colour == White && left.y == 7)
|
if ((my_colour == White && left.y == 7)
|
||||||
|| (my_colour == Black && left.y == 0))
|
|| (my_colour == Black && left.y == 0))
|
||||||
|
|
||||||
for (auto piece : {Rook, Knigt, Bishop, Queen})
|
for (auto piece : {Rook, Knigt, Bishop, Queen})
|
||||||
ret.push_back(Move{
|
ret.push_back(Move{
|
||||||
xy.to_index(),
|
xy.to_index(),
|
||||||
left.to_index(),
|
left.to_index(),
|
||||||
.promoting_to = (int8_t) (my_colour | piece)
|
(int8_t) (my_colour | piece)
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
ret.push_back(Move{xy.to_index(), left.to_index()});
|
ret.push_back(Move{xy.to_index(), left.to_index()});
|
||||||
@ -42,7 +41,7 @@ std::vector<Move> pawn_moves(const Board& b, const Coords xy) {
|
|||||||
ret.push_back(Move{
|
ret.push_back(Move{
|
||||||
xy.to_index(),
|
xy.to_index(),
|
||||||
right.to_index(),
|
right.to_index(),
|
||||||
.promoting_to = (int8_t) (my_colour | piece)
|
(int8_t) (my_colour | piece)
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
ret.push_back(Move{xy.to_index(), right.to_index()});
|
ret.push_back(Move{xy.to_index(), right.to_index()});
|
@ -1,7 +1,8 @@
|
|||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
|
#include "../utils/move.hpp"
|
||||||
|
|
||||||
std::vector<Move>
|
std::vector<Move>
|
||||||
keep_only_blocking(const std::vector<Move> candidates, const Board& board) {
|
keep_only_blocking(const std::vector<Move> candidates, const Board& board) {
|
@ -1,6 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "../move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
@ -1,6 +1,6 @@
|
|||||||
#include "../board.hpp"
|
#include "../board/board.hpp"
|
||||||
#include "../coords.hpp"
|
#include "../utils/coords.hpp"
|
||||||
#include "../move.hpp"
|
#include "../utils/move.hpp"
|
||||||
#include "piece.hpp"
|
#include "piece.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "castle_side.hpp"
|
#include "../board/castle_side.hpp"
|
||||||
|
#include "../pieces/piece.hpp"
|
||||||
#include "coords.hpp"
|
#include "coords.hpp"
|
||||||
#include "pieces/piece.hpp"
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <sstream>
|
#include <sstream>
|
Loading…
x
Reference in New Issue
Block a user