/// <summary> /// Create a board by copying the squares from an existing board /// </summary> /// <param name="sourceBoard">Board to copy</param> public Board(Board sourceBoard) { _squares = new Square[3, 3]; if (sourceBoard != null) { Array.Copy(sourceBoard.Squares, Squares, sourceBoard.Squares.Length); } }
/// <summary> /// Clear the board of all moves /// </summary> public void ClearBoard() { for (int iX = 0; iX < 3; iX++) { for (int iY = 0; iY < 3; iY++) { _squares[iX, iY] = new Square(); } } }
public Row(Square cell1, Square cell2, Square cell3) { Cells = new List<Square>{cell1, cell2, cell3}; }
/// <summary> /// Create a new attempted move for the given player to a given square /// </summary> /// <param name="player">Player who is moving</param> /// <param name="square">Square that the player is attempting to play</param> public Move(Player player, Square square) { _player = player; _square = square; }
/// <summary> /// Create an empty Board /// </summary> public Board() { _squares = new Square[3, 3]; ClearBoard(); }