Example #1
0
        public Form1()
        {
            InitializeComponent();
            _writer = new TextBoxStreamWriter(LogOutput);
            Console.SetOut(_writer);

            CardTemplate.DatabasePath = System.IO.Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) + "\\";
            CardTemplate.LoadAll();
            StreamReader str       = new StreamReader(CardTemplate.DatabasePath + "Bots/SmartCC/Config/useProfiles");
            string       useDefaut = str.ReadLine();

            str.Close();

            if (useDefaut == "true")
            {
                string star = CardTemplate.DatabasePath;
                Application.EnableVisualStyles();
                Application.Run(new ProfileSelector(CardTemplate.DatabasePath));
            }
            else
            {
                using (CodeCompiler compiler = new CodeCompiler(CardTemplate.DatabasePath + "Bots\\SmartCC\\Profiles\\Defaut\\", CardTemplate.DatabasePath))
                {
                    if (compiler.Compile())
                    {
                    }
                }
                String path = CardTemplate.DatabasePath + "Bots/SmartCC/Profile.current";
                using (var stream = new FileStream(path, FileMode.Truncate))
                {
                    using (var writer = new StreamWriter(stream))
                    {
                        writer.WriteLine("Defaut");
                        writer.Close();
                    }
                }
            }
            s = new Simulation();
            ValuesInterface.LoadValuesFromFile();
            ProfileInterface.LoadBehavior();

            Seed            = new Board();
            Seed.HeroEnemy  = Card.Create("HERO_01", true, GenerateId());
            Seed.HeroFriend = Card.Create("HERO_02", false, GenerateId());

            Seed.HeroFriend.CurrentHealth = 30;
            Seed.HeroFriend.MaxHealth     = 30;

            Seed.HeroEnemy.CurrentHealth = 30;
            Seed.HeroEnemy.MaxHealth     = 30;

            Seed.ManaAvailable = 10;

            ClearUI(ActionDenotator.NEW);
            UpdateUI();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            s.CreateLogFolder();
            s.SeedSimulation(root);

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            ValuesInterface.LoadValuesFromFile();
            ProfileInterface.LoadBehavior();
            s.Simulate(false);

            stopWatch.Stop();
            Console.WriteLine("Simulation stopped after :" + (stopWatch.ElapsedMilliseconds / 1000.0f).ToString());
        }