Ejemplo n.º 1
0
        static void PerformGameBenchmarking()
        {
            Dictionary<int, int> wins = new Dictionary<int, int>(4);

            for (int i = 0; i < 1000; i++)
            {
                var controller = new GameController();
                var agents = new IAgent[] { new StarterAgent(), new StarterAgent(), new StarterAgent() }; // new HumanAgent()
                int intWinner = controller.StartGame(agents, i, i, false, false);
                //var winner = agents[intWinner];

                if (wins.ContainsKey(intWinner))
                {
                    wins[intWinner] = wins[intWinner] + 1;
                }
                else
                {
                    wins.Add(intWinner, 1);
                }
                Console.WriteLine(i + ": P " + intWinner + " wins.");
            }

            Console.WriteLine();
            wins.OrderBy(w => w.Key).ForEach(kv => Console.WriteLine("Player " + kv.Key + ": " + kv.Value + " wins."));
        }
Ejemplo n.º 2
0
 public MainActions(Player player, GameController controller)
 {
     this.player = player;
     this.controller = controller;
     valid = true;
     this.hasPlayedDevCard = false;
     this.isAfterDieRoll = false;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            //PerformGameBenchmarking();

            var controller = new GameController();
            var agents = new IAgent[] { new StarterAgent(), new StarterAgent(), new StarterAgent(), new StarterAgent() }; // new HumanAgent()
            int intWinner = controller.StartGame(agents, 10, 0, false, true);

            if (intWinner != -1)
            {
                var winner = agents[intWinner];
                Console.WriteLine("Winner is: " + winner.GetName() + " (" + intWinner + ")");
            }
            else
            {
                Console.WriteLine("It is a draw after 100 rounds");
            }

            Console.WriteLine(controller.GetBoard());
        }
Ejemplo n.º 4
0
 public StartActions(Player player, GameController controller)
 {
     this.player = player;
     this.controller = controller;
 }