Ejemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*
             * ApplicationContext ac = new ApplicationContext();
             * SudokuGrid grid = new SudokuGrid(false);
             *
             * Form f1 = new GridForm(grid);
             * Form f2 = new ControlForm(grid);
             * Rectangle r = Screen.PrimaryScreen.WorkingArea;
             * f1.Location = new Point((r.Width - f1.Width - f2.Width) / 2, (r.Height - f1.Height) / 2);
             * f2.Location = new Point((r.Width + f1.Width - f2.Width) / 2, (r.Height - f2.Height) / 2);
             * f1.Show();
             * f2.Show();
             *
             * f2.AddOwnedForm(f1);
             *
             * Application.Run(ac);
             */

            var        options = new SudokuGrid.GridOptions(3, 3, '1');
            SudokuForm form    = new SudokuForm(new SudokuGrid(options));

            Application.Run(form);
        }
Ejemplo n.º 2
0
 public void InitControls(SudokuForm form, SudokuGrid.GridOptions options)
 {
     this.form               = form;
     tbWidth.Text            = options.cellA.ToString();
     tbHeight.Text           = options.cellB.ToString();
     rbJigsaw.Checked        = options.isJigsaw;
     rbKiller.Checked        = options.isKiller;
     rbNormal.Checked        = !options.isJigsaw && !options.isKiller;
     cbMajorDiagonal.Checked = options.majorDiagonal;
     cbMinorDiagonal.Checked = options.minorDiagonal;
 }
Ejemplo n.º 3
0
 public void CreateGrid(SudokuGrid.GridOptions options)
 {
     CurFile = null;
     Grid.ClearGrid(options);
     if (options.isKiller)
     {
         Grid.SetDefaultKiller();
     }
     Grid.Setup();
     UpdateMode();
 }
Ejemplo n.º 4
0
        SudokuGrid.GridOptions CreateOptions()
        {
            if (!ParseWidthHeight())
            {
                return(null);
            }
            char start = '1';

            if (boxWidth * boxHeight > 9)
            {
                start = 'A';
            }
            var ret = new SudokuGrid.GridOptions(boxWidth, boxHeight, start);

            ret.isJigsaw      = rbJigsaw.Checked;
            ret.isKiller      = rbKiller.Checked;
            ret.majorDiagonal = cbMajorDiagonal.Checked;
            ret.minorDiagonal = cbMinorDiagonal.Checked;
            return(ret);
        }
Ejemplo n.º 5
0
 void CheckHeader(string[] a, out int i, out GridOptions options)
 {
     options = new SudokuGrid.GridOptions(3, 3, '1');
     i       = 0;
     while (i < a.Length)
     {
         string line = a[i].ToUpperInvariant();
         if (options.CheckDiagonalsLine(line))
         {
             i++;
         }
         else if (options.CheckSizeLine(line))
         {
             i++;
         }
         else
         {
             options.DefaultBoxes();
             return;
         }
     }
 }
Ejemplo n.º 6
0
        public Generator(SudokuGrid.GridOptions options)
        {
            grid = new SudokuGrid(options);
            grid.Setup();

            desc = options.isJigsaw ? "Jigsaw" : options.isKiller ? "Killer" : "Normal";
            if (grid.MajorDiagonal && grid.MinorDiagonal)
            {
                desc += " Cross";
            }
            else if (grid.MajorDiagonal)
            {
                desc += " Major";
            }
            else if (grid.MinorDiagonal)
            {
                desc += " Minor";
            }
            desc += " " + options.Cells;

            new Thread(new ThreadStart(AutoGenerate)).Start();
        }