Example #1
0
        public void AnotherGrid()
        {
            NbGoodRes = 0;
            bool ok;

            do
            {
                Cells.Clear();
                HorizontalTargets.Clear();
                VerticalTargets.Clear();
                InitializeResults(GridSize);
                ok = true;
                InitializeCells(GridSize);
                LinkCellsToResults(GridSize);
                foreach (var item in HorizontalTargets)
                {
                    if (item.Result == 0)
                    {
                        ok = false;
                    }
                }
                foreach (var item in VerticalTargets)
                {
                    if (item.Result == 0)
                    {
                        ok = false;
                    }
                }
            } while (!ok);

            SetBitsTo0();
            _eventAggregator.GetEvent <OnStartTimerEvent>().Publish(new OnStartTimerEventArgs());
        }
Example #2
0
        public void GenerateGrid(GenerateGridEventArgs args)
        {
            switch (args.DifficultyName)
            {
            case "Easy":
                GridSize    = 4;
                cellSize    = 50;
                fontSize    = 22;
                resFontSize = 22;
                break;

            case "Normal":
                GridSize    = 6;
                cellSize    = 32;
                fontSize    = 20;
                resFontSize = 18;
                break;

            case "Expert":
                GridSize    = 8;
                cellSize    = 23;
                fontSize    = 14;
                resFontSize = 7;
                break;

            default:
                break;
            }
            NbGoodRes = 0;
            bool ok;

            do
            {
                Cells.Clear();
                HorizontalTargets.Clear();
                VerticalTargets.Clear();
                InitializeResults(GridSize);
                ok = true;
                InitializeCells(GridSize);
                LinkCellsToResults(GridSize);
                foreach (var item in HorizontalTargets)
                {
                    if (item.Result == 0)
                    {
                        ok = false;
                    }
                }
                foreach (var item in VerticalTargets)
                {
                    if (item.Result == 0)
                    {
                        ok = false;
                    }
                }
            } while (!ok);

            SetBitsTo0();
        }