3
// File : chessplayer.h
5
// Authors : Maxwell Lazaroff and Michael Cook, fixed by Joe Flint
7
// Description : Implements how a player works
9
#ifndef __CHESSPLAYER_H_IS_INCLUDED__
10
#define __CHESSPLAYER_H_IS_INCLUDED__
12
#include "boardmove.h"
19
typedef unsigned int uint;
25
ChessPlayer( const string & name ) { _name = name; };
26
virtual ~ChessPlayer() {};
28
static bool is_in(const BoardMove & move, const Board & board);
29
static bool is_valid(const BoardMove & move, const Board & board, bool is_white);
30
static bool inCheckmate(const Board &board, bool is_white);
31
static bool inStalemate(const Board &board, bool is_white);
33
virtual bool requiresInput() { return true; }
34
virtual BoardMove decide_move(const Board & board, bool & white) = 0;
35
virtual void opponent_move(const BoardMove & move, bool white ) {};
36
static bool check_move(const BoardMove & move, const Board &board, bool white);
38
static ChessPlayer* get_player(const string& player_name);
40
static void add_player(ChessPlayer* player);
42
virtual ChessPlayer* dup() const = 0;
44
static ChessPlayer* lookup(const string& player_name);
46
static vector<string> names();
48
string getName() { return _name; }
50
void append_name(string appender) { _name += appender; }
54
static vector<ChessPlayer*> _players;