Ejemplo n.º 1
0
        public void TestPriorityQueue()
        {
            var priorityQueue = new PriorityPositionQueue((first, second) => (first.X + first.Y).CompareTo(second.X + second.Y));

            for (int i = 0; i < Elements; i++)
            {
                priorityQueue.Enqueue(_toAddX[i], _toAddY[i]);
            }
        }
Ejemplo n.º 2
0
        public void NoWalls_PriorityQueue()
        {
            var      markMatrix = new int[10, 10];
            Position center     = new Position(5, 5);
            Func <Position, Position, int> distanceToCenterComparer =            // favours positions closer to center
                                                                      (first, second) => Position.Distance(center, first).CompareTo(Position.Distance(center, second));
            var priorityQueue   = new PriorityPositionQueue(distanceToCenterComparer);
            var floodParameters = new FloodParameters(priorityQueue, 1, 1);

            new FloodSpiller().SpillFlood(floodParameters, markMatrix);

            string representation = MarkMatrixVisualiser.Visualise(markMatrix);

            Console.WriteLine(representation);
        }