Removed the python version and kept just the c++ one
This commit is contained in:
.gitignoreMakefile
cpp
python
res
black-bishop.pngblack-king.pngblack-knight.pngblack-pawn.pngblack-queen.pngblack-rook.pngtrimmed.pngwhite-bishop.pngwhite-king.pngwhite-knight.pngwhite-pawn.pngwhite-queen.pngwhite-rook.png
src
tests
res
src
controller
ai_vs_ai.cppai_vs_ai.hppcontroller.cppcontroller.hpphuman_vs_ai.cpphuman_vs_ai.hppmanual.cppmanual.hpp
main.cppmodel
ais
ai.cppai.hppv0_random.cppv1_pure_minimax.cppv2_alpha_beta.cppv3_AB_ordering.cppv4_search_captures.cpp
board
perft
pieces
utils
view
tests
35
src/model/utils/utils.cpp
Normal file
35
src/model/utils/utils.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "../board/board.hpp"
|
||||
|
||||
std::vector<int8_t> to_target_square(std::vector<Move> moves) {
|
||||
std::vector<int8_t> ret;
|
||||
for (Move move : moves)
|
||||
ret.push_back(move.target_square);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int piece_value(Piece p) {
|
||||
switch (p) {
|
||||
case Piece::Pawn:
|
||||
return PawnValue;
|
||||
case Piece::Knigt:
|
||||
return KnightValue;
|
||||
case Piece::Bishop:
|
||||
return BishopValue;
|
||||
case Piece::Rook:
|
||||
return RookValue;
|
||||
case Piece::Queen:
|
||||
return QueenValue;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int count_material(const Board& b, int8_t colour) {
|
||||
int ret = 0;
|
||||
for (int i = 0; i < 64; i++)
|
||||
if (b.colour_at(i) == colour)
|
||||
ret += piece_value(b.piece_at(i));
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user