implemented some stuff

This commit is contained in:
Karma Riuk 2025-02-02 17:13:55 +01:00
parent 585e392b6a
commit 29453fbb14
7 changed files with 42 additions and 8 deletions

2
.gitignore vendored
View File

@ -171,4 +171,4 @@ cython_debug/
.ruff_cache/
# PyPI configuration file
.pypirc
.pypirc

BIN
cpp/main

Binary file not shown.

View File

@ -1,14 +1,9 @@
#pragma once
#include "piece.hpp"
#include "pieces/piece.hpp"
#include <string>
enum CastleRights : int8_t {
KingSide = 1,
QueenSide = 2,
};
class Board {
private:
int8_t squares[64] = {Piece::None};

7
cpp/src/castle_side.hpp Normal file
View File

@ -0,0 +1,7 @@
#include <cstdint>
enum class CastleSide : int8_t {
Neither = 0,
King = 1,
Queen = 2,
};

View File

@ -1,6 +1,11 @@
#include "castle_side.hpp"
#include <cstdint>
struct Move {
int8_t start_square;
int8_t piece;
int8_t target_square;
bool is_capturing = false;
CastleSide castle_side = CastleSide::Neither;
};

19
cpp/src/pieces/piece.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "piece.hpp"
#include "../board.hpp"
std::vector<Move> pawn_moves(Board b) {
return {};
}
std::vector<Move> legal_moves(Piece p, Board b) {
switch (p) {
case Piece::Pawn:
return pawn_moves(b);
case Piece::Bishop:
break;
default:
break;
}
return {};
}

View File

@ -1,4 +1,9 @@
#pragma once
#include "../move.hpp"
#include <cstdint>
#include <vector>
enum Piece : int8_t {
None = 0,
@ -14,3 +19,6 @@ enum Colour : int8_t {
White = 8,
Black = 16,
};
class Board;
std::vector<Move> legal_moves(Piece p, Board b);