示例#1
0
 private void button_nr_Click(object sender, RoutedEventArgs e)
 {
     if (pns.active != null)
     {
         Button number = sender as Button;
         pns.active.Content = number.Content;
         int Row, Column, Number;
         pns.ButtonContent(grid, pns.active, buffer, out Row, out Column, out Number);
         pns.tab = buffer;
     }
 }
示例#2
0
 private void button_nr_Click(object sender, RoutedEventArgs e)
 {
     if (board.active != null)
     {
         Button number = sender as Button;
         board.active.Content = number.Content;
         int Row, Column, Number;
         board.ButtonContent(siatka, board.active, buffer, out Row, out Column, out Number);
         if (!solver.Check(Row, Column, buffer, Number))
         {
             board.active.Opacity    = 0.71;
             board.active.Background = Brushes.Red;
         }
         else
         {
             if (tab[Row, Column] != buffer[Row, Column])
             {
                 differences++;
             }
             board.active.Opacity    = 0.7;
             board.active.Background = Brushes.Violet;
         }
         if (solver.IfWin(buffer))
         {
             board.Win(siatka);
             combo_difficulty.SelectedIndex = -1;
         }
         if (differences > 4)
         {
             try
             {
                 tab_alt = solver.Solve(tab_alt, buffer, 0, 0);
                 if (solver.IfWin(tab_alt))
                 {
                     solver.Put_in(tab, tab_alt);
                 }
             }
             catch { }
             differences = 0;
         }
     }
 }