Skip to content
Snippets Groups Projects
Commit ea9818a7 authored by Bolla Péter's avatar Bolla Péter
Browse files

Implement and correct functions

MOVEMENT:
* New enum: Movement -- gives the purpose of a move if it you can make it {Mov, Cap, No}
* old void Move(int, int) function -> Movement CanMove(int, int) -- if the move is possible gives the purpose of the move
* void Move(int, int) -- if Movement CanMove(int, int) returns Mov -> Move is possible, this function executes the move
* bool Opponents(int, int) -- if i1, i2 is occupied and i1, i2 is from different teams returns true; else returns false;
* bool CanCapture(int, int) -- if Opponents(int, int) returns true and i2 isn't King returns true else returns false
GETTER:
* bool Occupied(int) -- returns if the square is occupied
* Piece GetPiece(int) -- returns the piece on the given square
* Color GetColor(int) -- returns the color of the given square
* bool IsMate() -- returns bool mate 
CHECK:
* bool TestIfCheck(Team) -- checks if the given team attacks and puts in check the other team
* bool CanStopCheck(Team) -- checks if the given team can defend check ((only started in chess.cpp))
* void Mate() --didnt start to write the code in chess.cpp

protected::
bool check, mate 
parent 924e75bf
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,10 @@ enum Team{
Light, Dark, None
};
enum Movement{
No, Cap, Mov
};
struct Piece{
Type type;
Team team;
......@@ -31,19 +35,28 @@ class Chess
{
public:
Chess(int, int);
void Move(int, int);
Movement CanMove(int, int); //Mov -> Move(int, int) ; Cap-> Capture(int, int) ; No -> #
void Capture(int, int);
bool Occupied(int, int);
Piece GetPiece(int, int);
Color GetColor(int, int);
Square GetSquare(int, int);
void Move(int, int);
bool Opponents(int, int);
bool CanCapture(int, int);
bool Occupied(int);
Piece GetPiece(int);
Color GetColor(int);
Square GetSquare(int);
bool IsMate();
bool TestIfCheck(Team);
bool CanStopCheck(Team); //If not -> Mate
void Mate();
~Chess();
protected:
std::vector<Square> Table;
int WID, HEIG;
bool check, mate;
};
#endif // CHESS_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment