Exemplo n.º 1
0
        void FindColorableBoards(Action <Tuple <string, int> > progress)
        {
            for (int i = _remainingBoards.Count - 1; i >= 0; i--)
            {
                var b = _remainingBoards[i];
                if (_coloringAnalyzer.Analyze(b))
                {
                    _remainingBoards.RemoveAt(i);
                    FixerWonBoards.Add(b);
                    ColorableBoards.Add(b);
                }

                DoProgress(progress, "Finding all colorable positions...");
            }

            BoardCounts.Add(ColorableBoards.Count);
        }
Exemplo n.º 2
0
        void Analyze(Action <Tuple <string, int> > progress)
        {
            while (_remainingBoards.Count > 0)
            {
                var wonBoards = new List <SuperSlimBoard>();
                for (int i = _remainingBoards.Count - 1; i >= 0; i--)
                {
                    var b             = _remainingBoards[i];
                    var lastThisRound = i >= 1 && CheckOrdering(b, _remainingBoards[i - 1]);

                    if (_swapAnalyzer.Analyze(b, FixerWonBoards))
                    {
                        _remainingBoards.RemoveAt(i);
                        wonBoards.Add(b);

                        DoProgress(progress, string.Format("Finding all {0} move wins...", BoardCounts.Count));
                    }

                    if (lastThisRound)
                    {
                        break;
                    }
                }

                if (wonBoards.Count > 0)
                {
                    BoardCounts.Add(wonBoards.Count);

                    foreach (var b in wonBoards)
                    {
                        FixerWonBoards.Add(b);
                    }

                    if (_remainingBoards.Count <= 0)
                    {
                        DeepestBoards = wonBoards.ToList();
                    }
                }
                else
                {
                    BoardCounts.Add(0);
                    break;
                }
            }
        }