internal Tile[,] board; // internal - because our classes must use this array and must be invisible for executable code #endregion Fields #region Constructors public Board() { board = new Tile [8, 8]; for (uint column = 0; column < 8; column++) for (uint row = 0; row < 8; row++) board[row, column] = new Tile(row, column); }
// move for all figures will the same, but possible moves will be different public void Move(Board _board, Tile _moveTile) { //if possibleMoves contain _moveTile then _board.board[_moveTile.x, _moveTile.y].figOnTile = this; _board.board[currentTile.x, currentTile.y].figOnTile = null; currentTile = _moveTile; SetPossibleMoves(_board); }
// default constructor public Bishop(String _colour, Board _board, Tile _tile) : base(_colour, _board, _tile) { SetPossibleMoves(_board); }
public Figure(String _colour, Board _board, Tile _tile) { colour = _colour; _board.board[_tile.x, _tile.y].figOnTile = this; // Add this figure on board currentTile = _tile; }