Advertisement
Guest User

Sample usage!

a guest
Nov 14th, 2013
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. public partial class Form1 : Form
  2.     {
  3.         public Form1()
  4.         {
  5.             InitializeComponent();
  6.         }
  7.        
  8.         private SudokuBoard _board;
  9.         private SudokuSolver _solver;
  10.  
  11.         private void Form1_Load(object sender, EventArgs e)
  12.         {
  13.             _board = new SudokuBoard(20, 20)
  14.             {
  15.                 Text = "Sudoku!",
  16.                 Location = new Point(5, 5)
  17.             };
  18.            
  19.             Controls.Add(_board);
  20.  
  21.             _solver = new SudokuSolver(_board);
  22.             _solver.GameCompleted += SolverOnGameCompleted;
  23.         }
  24.  
  25.         private void SolverOnGameCompleted(int numOfTrials)
  26.         {
  27.             MessageBox.Show(string.Format("No. of trials: {0}", numOfTrials));
  28.         }
  29.  
  30.         private void button2_Click(object sender, EventArgs e)
  31.         {
  32.             _board.ClearBoard();
  33.         }
  34.        
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {
  37.             _solver.Solve();
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement