示例#1
0
        /// <summary>
        /// Main entry point
        /// </summary>
        /// <param name="args">Command line arguments</param>
        public static void Main(string[] args)
        {
            // Initialize the logger
            Program.logFile = args[1];
            File.Delete(Program.logFile);
            Trace.LogWritten += Program.OnLogWritten;

            // Load games from file(s)
            string path  = args[0];
            var    games = Directory.Exists(path) ? CollectOBotLoader.LoadFromDirectory(path) : CollectOBotLoader.LoadFromFile(path);

            // Analyze games
            var analyzer   = new GameAnalyzer();
            var definition = analyzer.Run(
                games,
                new ClusterOptions
            {
                MinimumMatchRate = 0.75,
            });

            string filename = "c:\\cob\\clusters.txt";

            using (StreamWriter file = File.CreateText(filename))
            {
                var serializer = Serialization.GetSerializer(true);
                serializer.Formatting = Formatting.Indented;
                serializer.Serialize(file, definition);
            }

            System.Diagnostics.Process.Start(filename);
            System.Diagnostics.Process.Start(Program.logFile);
        }
        static void TestBadDeck()
        {
            GameAnalyzer gameAnalyzer = new GameAnalyzer();

            gameAnalyzer.OnGameStart();
            gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(HearthDb.Cards.Collectible[HearthDb.CardIds.Collectible.Druid.AddledGrizzly]));
            gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(HearthDb.Cards.Collectible[HearthDb.CardIds.Collectible.Mage.Aluneth]));
            gameAnalyzer.OnGameEnd();
        }
        public void TestPlayAllDeck()
        {
            //создаем деку и разыгрывает карты из нее
            //в итоге не должно остаться карт в после разыгрывания деки

            HearthDb.Deckstrings.Deck deck = HearthDb.Deckstrings.DeckSerializer.Deserialize("AAECAf0ECvsMoM4Cws4Cm9MCnOICo+sCpvACt/ECw/gCxvgCCk3JA+wHm8IC08UClscCm8sC1+ECluQC4vgCAA==");
            GameAnalyzer gameAnalyzer      = new GameAnalyzer();
            var          pEnum             = deck.GetCards().GetEnumerator();
            Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int> FindDeck = new Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int>();

            gameAnalyzer.OnGameStart();
            for (int i = 0; pEnum.MoveNext(); i++)
            {
                for (int cardNo = 0; cardNo < pEnum.Current.Value; cardNo++) //карта в 2х экземплярах
                {
                    gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(pEnum.Current.Key));
                }
                gameAnalyzer.GetBestDeck().CopyToDict(FindDeck, true);
            }
            Assert.AreEqual(FindDeck.Count, 0);
        }
        static void TestDeck()
        {
            HearthDb.Deckstrings.Deck deck = HearthDb.Deckstrings.DeckSerializer.Deserialize("AAECAf0ECvsMoM4Cws4Cm9MCnOICo+sCpvACt/ECw/gCxvgCCk3JA+wHm8IC08UClscCm8sC1+ECluQC4vgCAA==");
            GameAnalyzer gameAnalyzer      = new GameAnalyzer();
            var          pEnum             = deck.GetCards().GetEnumerator();
            Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int> FindDeck = new Dictionary <Hearthstone_Deck_Tracker.Hearthstone.Card, int>();

            gameAnalyzer.OnGameStart();
            for (int i = 0; pEnum.MoveNext(); i++)
            {
                for (int cardNo = 0; cardNo < pEnum.Current.Value; cardNo++)
                {
                    gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(pEnum.Current.Key));
                }
                gameAnalyzer.GetBestDeck().CopyToDict(FindDeck, true);
                if (i > 10)
                {
                    break;
                }
            }
            gameAnalyzer.OnGameEnd();
            //gameAnalyzer.OnOpponentPlayCard(new Hearthstone_Deck_Tracker.Hearthstone.Card(HearthDb.Cards.Collectible[HearthDb.CardIds.Collectible.Druid.AddledGrizzly]));
            //FindDeck = gameAnalyzer.GetBestDeck();
        }
示例#5
0
 public void TestSetup()
 {
     gameAnalyzer = new GameAnalyzer();
 }