Exemple #1
0
        /// <summary>
        /// Create the Dlx grid:
        /// Create the column headers for the grid and chains them
        /// together with the linked list.
        /// </summary>
        private void CreateDlxGrid()
        {
            // reset
            _columnHeaders.Clear();
            _solutionNodes.Clear();
            SolutionList.Clear();

            var primaryColCount = _puzzleSize.ToInt32() * _puzzleSize.ToInt32() * 4;

            // build DLX network
            _columnHeaders[0] = new DlxHeader(0);

            for (var column = 1; column <= primaryColCount; column++)
            {
                _columnHeaders[column] = new DlxHeader(column)
                {
                    Right = null,
                    Left  = _columnHeaders[column - 1]
                };

                // Connect the current column to the previous column.
                _columnHeaders[column - 1].Right = _columnHeaders[column];
            }

            // Connect last primary column to the root node.
            _columnHeaders[primaryColCount].Right = _columnHeaders[0];
            _columnHeaders[0].Left = _columnHeaders[primaryColCount];
        }
Exemple #2
0
 public void Stop()
 {
     RepositoryList.Clear();
     SolutionList.Clear();
     ProjectList.Clear();
 }