Example #1
0
 public bool IsEqualTo(SudokuBoard other)
 {
     for (int x = 0; x < 81; x++)
     {
         if (this.elements[x].Choices != other.elements[x].Choices)
             return false;
     }
     return true;
 }
Example #2
0
 public SudokuBoard(SudokuBoard other)
 {
     elements.Clear();
     SudokuCell temp;
     foreach (SudokuCell cell in other.elements)
     {
         temp = new SudokuCell();
         temp.Choices = cell.Choices;
         this.elements.Add(temp);
     }
     this.AssignHelpers();
 }
Example #3
0
 private void btnSolve_Click(object sender, EventArgs e)
 {
     //SudokuBoard board = new SudokuBoard();
     SudokuBoard board = new SudokuBoard(txtRow1.Text + txtRow2.Text + txtRow3.Text + txtRow4.Text + txtRow5.Text + txtRow6.Text + txtRow7.Text + txtRow8.Text + txtRow9.Text);
     btnSolve.Enabled = false;
     board.Solve();
     btnSolve.Enabled = true;
     string output = board.ToString();
     txtRow1.Text = output.Substring(0, 9);
     txtRow2.Text = output.Substring(9, 9);
     txtRow3.Text = output.Substring(18, 9);
     txtRow4.Text = output.Substring(27, 9);
     txtRow5.Text = output.Substring(36, 9);
     txtRow6.Text = output.Substring(45, 9);
     txtRow7.Text = output.Substring(54, 9);
     txtRow8.Text = output.Substring(63, 9);
     txtRow9.Text = output.Substring(72, 9);
 }
Example #4
0
 public void SetTestData()
 {
     SudokuBoard temp = new SudokuBoard("100007090030020008009600500005300900010080002600004000300000010040000007007000300");
     SudokuBoard temp2 = new SudokuBoard("000000000030020008009600500005300900010080002600004000300000010040000007007000300");
     for (int x = 0; x < 81; x++)
     {
         this.elements[x].Choices = temp.elements[x].Choices;
     }
 }
Example #5
0
 private static SudokuBoard OrBoardChoices(SudokuBoard b1, SudokuBoard b2)
 {
     SudokuBoard temp = new SudokuBoard();
     for (int x = 0; x < 81; x++)
     {
         temp.elements[x].Choices = b1.elements[x].Choices | b2.elements[x].Choices;
     }
     return temp;
 }