예제 #1
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));
                }
            }
        }
예제 #2
0
 public Body(Armor Helmet, Armor BodyArmor)
 {
     EquipedBodyArmor = BodyArmor.resetArmor();
     EquipedHelmet    = Helmet.resetArmor();
 }