public PicrossBoard(PicrossBoard copySource) { Puzzle = copySource.Puzzle; RowCount = Puzzle.RowCount; ColumnCount = Puzzle.ColumnCount; Matrix = new PicrossCell[RowCount, ColumnCount]; for (int rowIndex = 0; rowIndex < RowCount; rowIndex++) { for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++) { PicrossCell otherCell = copySource.Matrix[rowIndex, columnIndex]; Matrix[rowIndex, columnIndex] = new PicrossCell() { State = otherCell.State, Row = rowIndex, Column = columnIndex }; } } Columns = CopyColumns(copySource); Rows = CopyRows(copySource); ActiveLines = (new[] { Columns, Rows }).SelectMany(collection => collection); }
public PicrossBoard(PicrossPuzzle puzzle) { Puzzle = puzzle; RowCount = Puzzle.RowCount; ColumnCount = Puzzle.ColumnCount; Matrix = new PicrossCell[RowCount, ColumnCount]; for (int rowIndex = 0; rowIndex < RowCount; rowIndex++) { for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++) { Matrix[rowIndex, columnIndex] = new PicrossCell() { Row = rowIndex, Column = columnIndex }; } } Columns = GatherColumns(); Rows = GatherRows(); ActiveLines = (new[] { Columns, Rows }).SelectMany(collection => collection); }
public static PicrossBoard GetEmpty() => new PicrossBoard(PicrossPuzzle.GetEmpty());