2016-03-08 18:23:35 +00:00
|
|
|
#ifndef DEF_CHESSCONTEXT_H
|
|
|
|
|
|
|
|
#define DEF_CHESSCONTEXT_H
|
|
|
|
|
|
|
|
/* [1] Libs
|
|
|
|
=========================================================*/
|
|
|
|
/* (1) Internes */
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2016-03-09 13:23:00 +00:00
|
|
|
#include <stdlib.h>
|
2016-03-08 18:23:35 +00:00
|
|
|
|
|
|
|
/* (2) Externes */
|
|
|
|
#include "term.h"
|
|
|
|
#include "Player.h"
|
|
|
|
|
|
|
|
/* (3) Namespace */
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Definition
|
|
|
|
=========================================================*/
|
|
|
|
class ChessContext{
|
|
|
|
public:
|
|
|
|
ChessContext();
|
|
|
|
void init();
|
2016-03-09 13:23:00 +00:00
|
|
|
Piece* at(const int x, const int y);
|
|
|
|
bool checkMove(Piece& p, int x, int y);
|
|
|
|
|
|
|
|
// GETTERS
|
|
|
|
Player* getCurrent();
|
|
|
|
Player* getEnemy();
|
2016-03-08 18:23:35 +00:00
|
|
|
|
2016-03-09 14:30:03 +00:00
|
|
|
// IA : Intelligence Modulaire
|
|
|
|
|
2016-03-08 18:23:35 +00:00
|
|
|
// ATTRIBUTS
|
|
|
|
char _turn;
|
|
|
|
Player *_p1;
|
|
|
|
Player *_p2;
|
2016-03-09 13:23:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// FONCTIONS UTILITAIRES
|
|
|
|
bool checkPion(Piece& p, int x, int y);
|
|
|
|
bool checkFou(Piece& p, int x, int y);
|
|
|
|
bool checkTour(Piece& p, int x, int y);
|
|
|
|
bool checkCavalier(Piece& p, int x, int y);
|
|
|
|
bool checkRoi(Piece& p, int x, int y);
|
|
|
|
bool checkReine(Piece& p, int x, int y);
|
|
|
|
|
2016-03-08 18:23:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* [n] Inclusion du corps
|
|
|
|
=========================================================*/
|
2016-03-08 22:39:21 +00:00
|
|
|
#include "ChessContext.cpp"
|
2016-03-08 18:23:35 +00:00
|
|
|
|
|
|
|
#endif
|