internal Piece(QF.Piece piece) : this() { this.InitializeComponent(); this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true); this.piece = piece; }
private void InitializeBoard(QF.Board board, IEngine playerX, IEngine playerO) { int x = 0, y = 0; if (this.pieces != null) { for (x = 0; x < QF.Board.Dimension; x++) { for (y = 0; y < QF.Board.Dimension; y++) { if (this.pieces[x, y] != null) { this.Controls.Remove(this.pieces[x, y]); } } } } this.source = null; this.playerX = playerX; this.playerO = playerO; if (board == null) { this.board = new QF.Board(); } else { this.board = board; } this.pieces = new Piece[QF.Board.Dimension, QF.Board.Dimension]; for (x = 0; x < QF.Board.Dimension; x++) { for (y = 0; y < QF.Board.Dimension; y++) { Point point = new Point(x, y); Piece newPiece = new Piece(new QF.Piece(point, this.board.GetPiece(point))); newPiece.Selected += this.OnPieceSelected; this.pieces[x, y] = newPiece; this.Controls.Add(newPiece); } } this.UpdatePieceStates(); }
public void Reset(QF.Board board, IEngine playerX, IEngine playerO) { this.InitializeBoard(board, playerX, playerO); this.CheckForMoveGeneration(); this.RedrawBoard(); }