Hi all, long time, i introduced (in other forum) the idea of programming AI chess, that is; human vs computer (his pc, to be specific). But soon, the idea faded and died.

But, I'm bringing it again now . I wrote a little code and did some skteches, and decided how the board gonna be presented.

The language obviously is C++. The board is gonna be represented in the memory manually (dynamically) within a multi-dimensional array, [8][8].

My idea is to make a generic abstract class Pieces, that has all the pure virtual functions. Then, every piece have its own class, inherited from Pieces. The idea behind is pretty simple as you might think: Make general container (array) and fill it with pieces.

The board is gonna be a type of : Pieces, the generic class. Then we dynamically allocate the individual pieces. The emprty squares, that are in between the white pieces and the black pieces, are represented as null (0) square.

Making a move is pretty much taking the piece and change its memory (according to the desired location on the board), so we first change the memory address, then we nullify the original position (which no more hold any piece).
This is the array sketch, the zero insize a box indicates that it's a null position (no piece in it) :



The next picture below shows what happens to the board when a piece is moved:


And as we know, the possible openings (the very first move) are :
20 = 16 for Pawns + 4 for Knights


this is the code i got to so far (don't pay attention to either functions or data members for now):
Code:
class Pieces
{
protected:
	string m_Name;

public:
	Pieces(string name = "Piece"): m_Name(name){}
	virtual ~Pieces(){}

	virtual string GetName() = 0;
	virtual bool isLegal(Pieces* aPiece) = 0;
};



class Pawn : public Pieces 
{
public:
	Pawn(string name = "Pawn"): Pieces(name){}
	~Pawn(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

class Knight : public Pieces 
{
public:
	Knight(string name = "Knight"): Pieces(name){}
	~Knight(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

class Bishop : public Pieces 
{
public:
	Bishop(string name = "Bishop"): Pieces(name){}
	~Bishop(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

class Rook : public Pieces 
{
public:
	Rook(string name = "Rook"): Pieces(name){}
	~Rook(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

class King : public Pieces 
{
public:
	King(string name = "King"): Pieces(name){}
	~King(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

class Queen : public Pieces 
{
public:
	Queen(string name = "Queen"): Pieces(name){}
	~Queen(){}

	string GetName()
	{
		return m_Name;
	}

	bool isLegal(Pieces* aPiece)
	{
		return 0;
	}
};

int main()
{
	Pieces* board[8][8];
	
	//Allocating white pieces
	board[0][0] = new Rook();
	board[0][1] = new Knight();
	board[0][2] = new Bishop();
	board[0][3] = new Queen();
	board[0][4] = new King();
	board[0][5] = new Bishop();
	board[0][6] = new Knight();
	board[0][7] = new Rook();
	board[1][0] = new Pawn();
	board[1][1] = new Pawn();
	board[1][2] = new Pawn();
	board[1][3] = new Pawn();
	board[1][4] = new Pawn();
	board[1][5] = new Pawn();
	board[1][6] = new Pawn();
	board[1][7] = new Pawn();
	
	//Nullify the empty squares 
	board[2][0] = false;
	board[2][1] = false;
	board[2][2] = false;
	board[2][3] = false;
	board[2][4] = false;
	board[2][5] = false;
	board[2][6] = false;
	board[2][7] = false;

	board[3][0] = false;
	board[3][1] = false;
	board[3][2] = false;
	board[3][3] = false;
	board[3][4] = false;
	board[3][5] = false;
	board[3][6] = false;
	board[3][7] = false;

	board[4][0] = false;
	board[4][1] = false;
	board[4][2] = false;
	board[4][3] = false;
	board[4][4] = false;
	board[4][5] = false;
	board[4][6] = false;
	board[4][7] = false;

	board[5][0] = false;
	board[5][1] = false;
	board[5][2] = false;
	board[5][3] = false;
	board[5][4] = false;
	board[5][5] = false;
	board[5][6] = false;
	board[5][7] = false;

	//Allocation black pieces
	board[6][0] = new Pawn();
	board[6][1] = new Pawn();
	board[6][2] = new Pawn();
	board[6][3] = new Pawn();
	board[6][4] = new Pawn();
	board[6][5] = new Pawn();
	board[6][6] = new Pawn();
	board[6][7] = new Pawn();
	board[7][0] = new Rook();
	board[7][1] = new Knight();
	board[7][2] = new Bishop();
	board[7][3] = new Queen();
	board[7][4] = new King();
	board[7][5] = new Bishop();
	board[7][6] = new Knight();
	board[7][7] = new Rook();

	getch();
	return 0;
}
by looking at the sketch of the array, I could easily allocate the pieces.

Please, share info about what you know about programming chess. If you wanna help please do. And have a positive conversation.