예제 #1
0
        public static void vsAllInClass(string bulletName, int armorClass, int[] hitRegions)
        {
            Random rand = new Random();

            String docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "Output.txt")))
            {
                Bullet       bullet = Bullet.getBullet(bulletName);
                List <Armor> armors = Armor.getBodyArmor(armorClass);
                foreach (Armor armor in armors)
                {
                    double count = 0;
                    for (int i = 0; i < 1000; i++)
                    {
                        Body body = new Body(new Armor(), armor);


                        while (!body.isDead())
                        {
                            body.takeDamage(bullet, randomRegion(hitRegions, rand), rand);
                            count++;
                        }
                    }
                    outputFile.Write(armor.Name + " | ");
                    outputFile.WriteLine(count / 1000);
                }
            }
        }
예제 #2
0
        public static void singleSim(string bulletName, string armorName)
        {
            Random rand = new Random();

            String docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "Output.txt")))
            {
                Bullet bullet = Bullet.getBullet(bulletName);
                Armor  armor  = Armor.getBodyArmor(armorName);

                int iters = 1000000;

                for (int cycle = 0; cycle < 10000; cycle++)
                {
                    int count = 0;
                    for (int iteration = 0; iteration < iters; iteration++)
                    {
                        armor.resetArmor();
                        if (armor.simulateBlock(bullet, rand))
                        {
                            count++;
                        }
                    }
                    if (cycle % 100 == 0)
                    {
                        Console.WriteLine(cycle / 100);
                    }
                    outputFile.WriteLine(count / (iters / 100));
                }
            }
        }
예제 #3
0
        public static void testAllCases(int[] ODDS_ARRAY)
        {
            Random rand = new Random();

            String docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "Output.txt")))
            {
                List <Armor> helmets = new List <Armor>();
                helmets.Add(new Armor()); //nothing
                helmets.Add(Armor.getHelmet("Kolpak-1S"));
                helmets.Add(Armor.getHelmet("6B47 Ratnik"));
                helmets.Add(Armor.getHelmet("Fast MT SUPER HIGH CUT"));
                helmets.Add(Armor.getHelmet("Altyn helmet"));
                helmets.Add(Armor.getVisor("Altyn face shield"));
                helmets.Add(Armor.getHelmet("Vulkan-5"));
                helmets.Add(Armor.getVisor("Maska 1Sch face shield"));



                List <Armor> bodyArmors = new List <Armor>();
                bodyArmors.Add(new Armor()); //also nothing
                bodyArmors.Add(Armor.getBodyArmor("PACA"));
                bodyArmors.Add(Armor.getBodyArmor("UNTAR"));
                bodyArmors.Add(Armor.getBodyArmor("Kirasa"));
                bodyArmors.Add(Armor.getBodyArmor("Trooper"));
                bodyArmors.Add(Armor.getBodyArmor("6B23-2"));
                bodyArmors.Add(Armor.getBodyArmor("Korund"));
                bodyArmors.Add(Armor.getBodyArmor("Redut-T5"));
                bodyArmors.Add(Armor.getBodyArmor("Hexgrid"));
                bodyArmors.Add(Armor.getBodyArmor("Zabralo-Sh"));


                List <Bullet> bullets = Bullet.getAllBullets();


                //TODO, use json to pull all these numbers out into factory class

                foreach (Bullet bullet in bullets)
                {
                    foreach (Armor helmet in helmets)
                    {
                        foreach (Armor bodyArmor in bodyArmors)
                        {
                            int count = 0;
                            for (int i = 0; i < 1000; i++)
                            {
                                Body body = new Body(helmet, bodyArmor);


                                while (!body.isDead())
                                {
                                    body.takeDamage(bullet, randomRegion(ODDS_ARRAY, rand), rand);
                                    count++;
                                }
                            }


                            Console.Write(bullet.Name);
                            outputFile.Write(bullet.Name);
                            Console.Write("|");
                            outputFile.Write("|");
                            Console.Write(helmet.Name);
                            outputFile.Write(helmet.Name);
                            Console.Write("|");
                            outputFile.Write("|");
                            Console.Write(bodyArmor.Name);
                            outputFile.Write(bodyArmor.Name);
                            Console.Write("|");
                            outputFile.Write("|");
                            Console.WriteLine(count / 1000f);
                            outputFile.WriteLine(count / 1000f);
                        }
                    }
                }
            }
            Console.ReadLine();
        }