26 lines
839 B
C++
26 lines
839 B
C++
//
|
|
// Created by hamac on 18.12.2024.
|
|
//
|
|
|
|
#include "Chesspiece.h"
|
|
|
|
Chesspiece::Chesspiece(char color, std::pair<int, int> position)
|
|
: color(color), position(position) {}
|
|
|
|
std::pair<int, int> Chesspiece::getPosition() { return this->position; };
|
|
void Chesspiece::setPosition(std::pair<int, int> position) {
|
|
this->position = position;
|
|
Chesspiece::calcAvaibleMoves(); // Brett -> Auswahl Figuren -> Züge gewählte
|
|
}
|
|
|
|
char Chesspiece::getColor() { return color; }
|
|
void Chesspiece::setColor(char color) { color = color; }
|
|
|
|
std::vector<std::string> Chesspiece::getAvaibleMoves() { return avaibleMoves; }
|
|
|
|
bool Chesspiece::checkNotation(std::string notation) {
|
|
std::regex pattern("R^([KQRNBP]?)([a-h][1-8])[-x]([a-h][1-8])([+#]?)$");
|
|
std::smatch match;
|
|
return (std::regex_search(notation, match, pattern) ? true : false);
|
|
}
|