Initial commit of MPLABX version

This commit is contained in:
A.M. Rowsell 2025-07-30 21:48:16 -04:00
commit d80b03bdf0
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
10 changed files with 251 additions and 0 deletions

45
Piece.hpp Normal file
View file

@ -0,0 +1,45 @@
/*
* File: Piece.hpp
* Author: amr
*
* Created on July 30, 2025, 9:21 PM
*/
#ifndef PIECE_HPP
#define PIECE_HPP
#pragma once
#include <stdint.h>
#include <utility>
#include <vector>
#include "Board.hpp"
class Board;
enum PieceType { PAWN, BISHOP, KNIGHT, ROOK, QUEEN, KING, EMPTY };
enum PieceColour { PIECE_WHITE, PIECE_BLACK, PIECE_EMPTY };
enum Rank { R1 = 1, R2 = 2, R3 = 3, R4 = 4, R5 = 5, R6 = 6, R7 = 7, R8 = 8 };
enum File { A, B, C, D, E, F, G, H };
struct Square {
Rank rank;
File file;
};
class Piece {
protected:
PieceColour colour;
public:
// methods
Piece(PieceColour pColour) : colour(pColour) {}
virtual ~Piece() {}
virtual std::vector<std::pair<int, int>> getLegalMoves(int x, int y, const Board &board) const;
PieceColour getColour() const { return colour; }
};
class King : public Piece {
public:
King(PieceColour colour) : Piece(colour) {}
std::vector<std::pair<int, int>> getLegalMoves(int x, int y, const Board &board) const override;
};
#endif // PIECE_HPP