Ejemplo n.º 1
0
        void Run()
        {
            var start = new Vector2i(Width / 2, Height / 2);

            //start with one pixel colored
            SetPixel(start, ColorSource.Get());

            while (running && ColorSource.Count > 0 && front.Count > 0)
            {
                Color4b color = ColorSource.Get();

                int      bestScore = int.MaxValue;
                Vector2i bestPos   = new Vector2i();

                foreach (var v in front)
                {
                    int score = GetScore(v, color);
                    if (score < bestScore)
                    {
                        bestScore = score;
                        bestPos   = v;
                    }
                }

                front.Remove(bestPos);

                SetPixel(bestPos, color);
            }
        }