public MapController(TableController tableCtrl, StaticsController sctrl, SolverController solver, MainWindow mw)
        {
            mainWindow = mw;
            solverCtrl = solver;
            statCtrl = sctrl;
            tableController = tableCtrl;

            maps = new List<Problem>();
            db = new MySqlDB();

            LoadMapsFromDB();

            GenerateMap(maps.ElementAt(0));
        }
        private void GenerateNewMap()
        {
            stats = new StaticsController(this);
            tableCtrl = new TableController(this, stats);
            solver = new SolverController(tableCtrl.Table, this);
            mapCtrl = new MapController(tableCtrl, stats, solver, this);

            tableCtrl.ShowCandidates = false;
            tableCtrl.PreSetBadValues(false);
        }
        public void SolveTableBeforeGame(SolverController solver)
        {
            MakeCandidatesForTableCells();

            do {
                ClearAllExceptDefaults();
                solver.GetSolvedMap();
            } while (!CheckTable());

            solvedTable = new Table();
            foreach (var row in Table.Cells)
            {
                var sr = new List<Cell>();
                foreach (var cell in row)
                {
                    var sc = new Cell();
                    sc.Value = cell.Value;
                    sr.Add(sc);
                    if (!cell.IsDefault) cell.Value = 0;
                }
                solvedTable.Cells.Add(sr);
            }
            RenderTable();
        }