Пример #1
0
        static void Main(string[] args)
        {
            var op1 = new SmartAI();
            var op2 = new RandomOpponent();

            BattleshipCompetition bc = new BattleshipCompetition(
                op1,
                op2,
                new Size(10, 10),       // Board Size
                2, 3, 3, 4, 5           // Ship Sizes
            );

            var winner = bc.RunCompetition();

            Console.WriteLine("{0} won the match!", winner.Name);

            Console.ReadKey(true);
        }
Пример #2
0
        static void Main(string[] args)
        {
            var op1 = new RandomOpponent();
            var op2 = new RandomOpponent();

            BattleshipCompetition bc = new BattleshipCompetition(
                op1,
                op2,
                new TimeSpan(0, 0, 1),  // Time per game
                51,                     // Wins per match
                true,                   // Play out?
                new Size(10, 10),       // Board Size
                2, 3, 3, 4, 5           // Ship Sizes
            );

            var scores = bc.RunCompetition();

            foreach (var key in scores.Keys.OrderByDescending(k => scores[k]))
            {
                Console.WriteLine("{0} {1}:\t{2}", key.Name, key.Version, scores[key]);
            }

            Console.ReadKey(true);
        }