public void HasOnlyOnePlaceForTest() { int?[,] sampleGrid = new int?[9, 9] { {7,2,5,4,8,1,6,9,3}, {null,1,8,null,null,7,2,5,4}, {9,null,4,2,5,null,7,8,1}, {8,9,7,1,3,2,5,4,6}, {null,null,null,null,4,null,3,null,9}, {null,4,null,null,null,null,1,null,8}, {4,7,2,null,1,null,9,null,5}, {null,5,9,null,7,4,8,1,2}, {null,8,null,5,2,9,4,null,7} }; Grid g = new Grid(sampleGrid); bool expected; bool actual; expected = true; actual = g.Columns[1].HasOnlyOnePlaceFor(g.Cells[2, 1], 3); Assert.AreEqual(expected, actual); expected = false; actual = g.Columns[1].HasOnlyOnePlaceFor(g.Cells[2, 1], 1); Assert.AreEqual(expected, actual); }
public MainForm() { InitializeComponent(); // Sudoku : Grid g = new Grid(this.ValidFullStartingMatrix); this.gridUserControl1.Grid = g; }
public GridUserControl(Grid grid) { this.InitializeComponent(); for (int row = 0; row < 9; row++) for (int col = 0; col < 9; col++) this._GridTableLayoutPanel.Controls.Add(new CellControl(), col, row); this.Grid = grid; }
private void button1_Click(object sender, EventArgs e) { int?[,] sampleGrid = new int?[9, 9] { {7,2,5,4,8,1,6,9,3}, {null,1,8,null,null,7,2,5,4}, {9,null,4,2,5,null,7,8,1}, {8,9,7,1,3,2,5,4,6}, {null,null,null,null,4,null,3,null,9}, {null,4,null,null,null,null,1,null,8}, {4,7,2,null,1,null,9,null,5}, {null,5,9,null,7,4,8,1,2}, {null,8,null,5,2,9,4,null,7} }; Grid g = new Grid(sampleGrid); this.gridUserControl1.Grid = g; }
private void _NewGridButton_Click(object sender, EventArgs e) { //int?[,] sampleGrid = new int?[9, 9] //{ // {null,null,null,null,null,null,null,null,null}, // {1,null,2,null,null,null,7,6,null}, // {null,4,null,6,1,null,null,9,8}, // {3,null,null,null,2,null,null,null,4}, // {6,8,null,null,4,null,null,null,7}, // {null,null,null,null,3,7,9,null,null}, // {null,null,null,3,null,null,null,null,null}, // {null,null,7,5,6,null,null,null,null}, // {null,3,6,null,null,null,5,1,null} //}; int?[,] sampleGrid = new int?[9, 9] { {null,null,null,null,null,null,null,null,null}, {null,null,null,null,9,null,7,6,5}, {null,null,null,1,null,6,null,9,null}, {null,null,3,null,null,null,null,null,4}, {null,8,1,null,null,5,2,null,null}, {null,5,2,6,null,1,null,null,null}, {5,null,null,null,null,null,null,null,null}, {2,null,null,null,6,9,null,null,3}, {3,null,null,2,null,8,5,1,null} }; Grid g = new Grid(sampleGrid); this.gridUserControl1.Grid = g; }
private void _FillGridButton_Click(object sender, EventArgs e) { Grid g = new Grid(this.ValidFullStartingMatrix); this.gridUserControl1.Grid = g; }