Example #1
0
 public Player(Game game, int id)
 {
     this.game = game;
      this.id = id;
      VersionSource = game;
      validHintCache = new List<Hint>();
      WillPlayAgain = true;
 }
Example #2
0
 static void Main(string[] args)
 {
     Game game = new Game(NumPlayers, HandSize);
      game.RunToCompletion();
      Console.WriteLine("\n\nDone! Final Score: {0}", game.FinalScore());
      game.PrintProgress();
      Console.WriteLine("Total Move Simulations: {0}, Aborted: {1}", Simulator.SimulationCount, Simulator.AbortedSimCount);
      Console.Write("Original Deck: ");
      game.Deck.PrintCardsInOrder();
      Console.ReadLine(); // Stop to see results.
 }
Example #3
0
 static void Main(string[] args)
 {
     int games = 100;
     int total = 0;
     for (int i = 0; i < games; i++)
     {
         Game g = new Game(2, Console.Out);  // System.IO.TextWriter.Null
         total += g.Run();
     }
     Console.Out.WriteLine("MEAN SCORE: {0}", 1.0 * total / games);
 }
Example #4
0
 public Simulation(Game game)
 {
     this.game = game;//.Copy();
     initialScore = game.GetScore();
     initialPlayer = game.GetCurrentPlayer();
 }
Example #5
0
 public static Tuple<int, Move> CalculateBestAction(Game game)
 {
     return new Simulation(game).Simulate(0);
 }
Example #6
0
 public Player(Game g, int idx)
 {
     this.Strategy = new Steller();
     this.Game = g;
     this.Index = idx;
     this.Cards = new List<HeldCard>();
 }
Example #7
0
        static int PlayGame()
        {
            Game g = new Game(2);

            // Deal initial cards.
            Console.Out.WriteLine("Drawing initial cards... ");
            for (int i = 0; i < 5; i++)
            {
                foreach (Player p in g.Players)
                {
                    p.AddCard(g.Draw());
                }
            }

            // Let players play.
            int turn = 1;
            int next = 0;
            while (!g.Done())
            {
                Console.Out.Write("Turn {0}: player {1} ", turn++, next + 1);
                Player p = g.Players[next];
                next = (next + 1) % g.Players.Count;

                p.Go();
            }

            int score = g.Deck.Score();
            Console.Out.WriteLine("SCORE: {0}", score);
            Console.Out.WriteLine("");
            return score;
        }