public PuzzleEditor(EditorGrid editorGrid) { if (editorGrid == null) { throw new ArgumentNullException(nameof(editorGrid)); } else { this.editorGrid = editorGrid; ambiguityChecker = new AmbiguityChecker(columnConstraints: editorGrid.DeriveColumnConstraints(), rowConstraints: editorGrid.DeriveRowConstraints()); ambiguityGrid = ambiguityChecker.Ambiguities.Map(( Ambiguity x ) => Cell.Create(x)).Copy(); facadeGrid = editorGrid.Contents.Map(position => new PuzzleEditorSquare(this, position, ambiguityGrid[position])).Copy(); columnConstraints = editorGrid.Contents.ColumnIndices.Select(x => new PuzzleEditorColumnConstraints(editorGrid, x)).ToSequence(); rowConstraints = editorGrid.Contents.RowIndices.Select(y => new PuzzleEditorRowConstraints(editorGrid, y)).ToSequence(); } }
private void ResetAmbiguities() { this.ambiguityChecker = new AmbiguityChecker(columnConstraints: editorGrid.DeriveColumnConstraints(), rowConstraints: editorGrid.DeriveRowConstraints()); RefreshAmbiguities(); }