Beispiel #1
0
        static void Main(string[] args)
        {
            //Console.SetWindowSize(maxCol + 10, maxRow + 10);
            //Console.SetWindowPosition(0, 0);

            var field = new Cell[maxCol, maxRow];
            Init(field);

            int[,] payoffMatrix = { { -25, 50 }, { 0, 15 } };

            var cellfinder = new RandomCellFinder(field);

            var evolution = new Evolution(field, cellfinder, payoffMatrix);
            for (int i = 0; i < 5000; i++)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();

                //DrawField(field);
                Console.CursorLeft = 0;
                Console.CursorTop = 0;

                PrintInfo(evolution);
                evolution.Tick();
                sw.Stop();
                Console.WriteLine("Ms per tick: " + sw.ElapsedMilliseconds);
                Console.WriteLine("Iteration nr: " + i);
            }
        }
Beispiel #2
0
 private static void PrintInfo(Evolution evolution)
 {
     decimal h, d, f, dd;
     evolution.GetInfo(out h, out d, out f, out dd);
     Console.WriteLine($"Hawks:{h:P}");
     Console.WriteLine($"Doves:{d:P}");
     Console.WriteLine($"Average fitness:{f}");
     Console.WriteLine($"Density:{dd:P}");
 }