public void Test1() { var temp = @" 1,1 "; var grid = new PicrossGrid(temp, GridInitializerEnum.GridString); Assert.AreEqual(1, grid.Rows.Count); Assert.AreEqual(2, grid.Columns.Count); }
public void IsInitializable_Unsolvable1() { var temp = @" 1,2,1,2 2,1,2,1 1,2,1,2 2,1,2,1 "; var grid = new PicrossGrid(temp, GridInitializerEnum.GridString); Assert.AreEqual(4, grid.Rows.Count); Assert.AreEqual(4, grid.Columns.Count); }
public void Canary2() { var temp = @" 1,2,1,1,1 "; var grid = new PicrossGrid(temp, GridInitializerEnum.GridString); Console.WriteLine(grid); Assert.AreEqual(1, grid.Rows.Count); Assert.AreEqual(5, grid.Columns.Count); Assert.AreEqual(4, grid.Rows[0].Colors.First(c => c.MyColor.Equals(Color.FromArgb(1))).Count); Assert.IsFalse(grid.Rows[0].Colors.First(c => c.MyColor.Equals(Color.FromArgb(1))).IsConnected); Assert.AreEqual(1, grid.Rows[0].Colors.First(c => c.MyColor.Equals(Color.FromArgb(2))).Count); Assert.IsTrue(grid.Rows[0].Colors.First(c => c.MyColor.Equals(Color.FromArgb(2))).IsConnected); }
private void LoadData(string path, bool doubleSolve = false) { GridHelpers.ResetCache(); _grid = new PicrossGrid(path, GridInitializerEnum.ImageFilePath); _solver = new PicrossSolver(_grid.RowCount, _grid.ColumnCount, _grid.Rows, _grid.Columns); _solver.Solve(); if (doubleSolve) { _solver.Solve(); } Rows = new List <RowPresenter>(); for (int i = 0; i < _grid.RowCount; i++) { Rows.Add(new RowPresenter(_solver.WorkingGrid.GetRow(i))); } Notify(() => Rows); RowClassifiers = _solver.Rows.Select(r => new ClassifierPresenter(r)).ToList(); ColumnClassifiers = _solver.Columns.Select(c => new ClassifierPresenter(c)).ToList(); }
protected override void GridInit(string initializer) { Grid = new PicrossGrid(initializer, GridInitializerEnum.ImageFilePath); }
protected override void GridInit(string initializer) { Grid = new PicrossGrid(initializer, GridInitializerEnum.GridString); }