예제 #1
0
        private static void TestEpidemicSimulator()
        {
            // TODO | dj | remove this!
            Process.GetCurrentProcess().MaxWorkingSet = new IntPtr(4294967296); // should limit the RAM to ~4GB.

            FactorContainer fc = new FactorContainer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
            var sim = EpidemicSimulator.Create(new Disease()
                {
                    Name = "TestDisease",
                    HealingFactor = fc,
                    ResistanceFactor = fc,
                    MortalityRate = fc,
                    Transferability = 75
                },
                "../../../EpidemicSim_InputDataParsers/germany.dep",
                new ConsoleOutputTarget(),
                DateTime.Now,
                new DebugInfectionComponent());
            sim.SetSimulationIntervall(1);
            sim.SetSnapshotIntervall(1);
            sim.ProcessFinished += (_, __) =>
                {
                    ReviewManager sm = new ReviewManager();
                    sm.OpenSimFile(DESKTOP_PATH + "\\TestDisease.sim");
                    sm.LoadTickSnapshot(sm.Entries[0]);
                    sm.CreateGraphics((EStatField)255, EColorPalette.Red, "testmap");
                    Console.WriteLine("DONE!");
                };
            sim.StartSimulation(DESKTOP_PATH + "\\dat.sim", InfectionInitState.Empty, 1);
        }
예제 #2
0
        public static void TestStats()
        {
            var manager = new ReviewManager();

            Console.WriteLine("Please enter the name of your .sim file:");

            string file = Console.ReadLine();
            if (file.EndsWith(".sim")) file = file.Remove(file.Length - 4);

            manager.OpenSimFile(
                Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/"
                + file + ".sim");

            var entries = manager.Entries;

            while (true) // I am Evil, I know |T|
            {
                foreach (string s in entries)
                {
                    Console.WriteLine(s);
                }
                Console.WriteLine("Please type a entryname:");
                string name = Console.ReadLine();

                if (!entries.Contains(name))
                    foreach (string entry in entries)
                        if (entry.StartsWith(name))
                        {
                            name = entry;
                            break;
                        }

                Console.WriteLine("Please enter number of Field to paint (AllHumans is 255)");
                int num = int.Parse(Console.ReadLine());
                EStatField field = (EStatField)num;

                Console.WriteLine("Please type a color scheme (Red, Blue, RedGreen[default]):");
                string palette = Console.ReadLine();
                EColorPalette pal = EColorPalette.RedGreen;
                if (palette.ToLower().Equals("red"))
                    pal = EColorPalette.Red;
                else if (palette.ToLower().Equals("blue"))
                    pal = EColorPalette.Blue;

                Console.WriteLine("Please insert desired File-Prefix:");
                string prefix = Console.ReadLine();

                manager.LoadTickSnapshot(name);

                Console.WriteLine("Normal(0) or Deathmap (1)");
                int op = int.Parse(Console.ReadLine());
                switch (op)
                {
                    case 0:
                        manager.CreateGraphics(field, pal, prefix);
                        break;
                    case 1:
                        manager.CreateDeathGraphics(field, pal, prefix);
                        break;
                    default:
                        manager.CreateGraphics(field, pal, prefix);
                        break;
                }
                Dictionary<string, Color> legend = manager.GetCaption();

                foreach (string str in legend.Keys)
                {
                    Console.WriteLine(str + " with " + legend[str].ToString());
                }

                Console.WriteLine("Finished!");
            }
        }