Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }