private PicrossActiveLine[] GatherColumns() { var columns = new PicrossActiveLine[ColumnCount]; for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++) { var columnCells = new List <PicrossCell>(); for (int rowIndex = 0; rowIndex < RowCount; rowIndex++) { columnCells.Add(Matrix[rowIndex, columnIndex]); } var columnRule = new PicrossLineRule( lineStructure: Puzzle.ColumnRules[columnIndex], lineLength: RowCount); columns[columnIndex] = new PicrossActiveLine( type: LineType.Column, index: columnIndex, cells: columnCells, rule: columnRule); } return(columns); }
private PicrossActiveLine[] GatherRows() { var rows = new PicrossActiveLine[RowCount]; for (int rowIndex = 0; rowIndex < RowCount; rowIndex++) { var rowCells = new List <PicrossCell>(); for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++) { rowCells.Add(Matrix[rowIndex, columnIndex]); } var rowRule = new PicrossLineRule( lineStructure: Puzzle.RowRules[rowIndex], lineLength: ColumnCount); rows[rowIndex] = new PicrossActiveLine( type: LineType.Row, index: rowIndex, cells: rowCells, rule: rowRule); } return(rows); }
public PicrossActiveLine(IEnumerable <PicrossCell> cells, PicrossLineRule rule, LineType type, int index) : base(cells) { Type = type; Index = index; Rule = rule; CandidateSolutions = Rule.GenerateCandidates().ToList(); ReviewCandidates(); RegisterCellHandlers(); }