Ejemplo n.º 1
0
        public void setup()
        {
            players = new Seat[5];
            for (int i = 0; i < 5; i++)
                players[i] = new Seat(i, "Player" + i, 1000);

            potMan = new PotManager(players);
        }
Ejemplo n.º 2
0
Archivo: Pot.cs Proyecto: tansey/poker
        /// <summary>
        /// Creates a new, empty Pot with the given name.
        /// </summary>
        public Pot(string potName, Seat[] players)
        {
            this.players = players;

            //.NET defaults to false on booleans, no need to initialize
            eligible = new bool[players.Length];

            size = 0;
            eligibleCount = 0;
            name = potName;
        }
Ejemplo n.º 3
0
 public void SetUp()
 {
     engine = new HandEngine();
     seqPlayers = new Seat[5];
     for (int i = 0; i < seqPlayers.Length; i++)
     {
         seqPlayers[i] = new Seat();
         seqPlayers[i].Chips = 200.0;
         seqPlayers[i].Name = "Seq" + i;
         seqPlayers[i].SeatNumber = i + 1;
     }
     blinds = new double[] { 1, 2 };
 }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            HandEngine engine = new HandEngine();

            Console.WriteLine("Loading cached hands");
            List<CachedHand> cachedHands;
            XmlSerializer ser = new XmlSerializer(typeof(CachedHands));
            using (TextReader txt = new StreamReader("test.xml"))
                cachedHands = ((CachedHands)ser.Deserialize(txt)).Hands;

            var seats = new Seat[6];
            seats[0] = new Seat(1, "AlwaysRaise", 100000, new AlwaysRaisePlayer());
            seats[1] = new Seat(2, "AwaysCall", 100000, new AlwaysCallPlayer());
            seats[2] = new Seat(3, "AwaysCall2", 100000, new AlwaysCallPlayer());
            seats[3] = new Seat(4, "AwaysCall3", 100000, new AlwaysCallPlayer());
            seats[4] = new Seat(5, "AwaysCall4", 100000, new AlwaysCallPlayer());
            seats[5] = new Seat(6, "AwaysCall5", 100000, new AlwaysCallPlayer());
            var blinds = new double[] { 1, 2 };
            uint handNumber = 0;
            double maxDifference = 0;
            Console.WriteLine("Starting simulation");
            DateTime start = DateTime.Now;
            for (; handNumber < 100; handNumber++)
            {
                HandHistory results = new HandHistory(seats, handNumber, handNumber % (uint)seats.Length + 1, blinds, 0, BettingStructure.NoLimit);
                engine.PlayHand(results, cachedHands[(int)handNumber]);
                double difference = Math.Abs(seats[0].Chips - seats[1].Chips);
                if (difference > maxDifference)
                    maxDifference = difference;
                if (seats[0].Chips == 0 || seats[1].Chips == 0)
                    break;
            }
            int time = DateTime.Now.Subtract(start).Milliseconds;
            Console.WriteLine("Time: {0}", time);
            Console.WriteLine("Hands: {0}", handNumber);
            Console.WriteLine("AlwaysRaise Bankroll: {0}", seats[0].Chips);
            Console.WriteLine("AlwaysCall Bankroll: {0}", seats[1].Chips);
            Console.WriteLine("Max Difference: {0}", maxDifference);
        }
Ejemplo n.º 5
0
        private void AddScores(double startingChips, List<int> playerIndices, Seat[] seats)
        {
            for (int i = 0; i < playerIndices.Count; i++)
            {
                int playerIdx = playerIndices[i];
                double profit = seats[i].Chips - startingChips;
                Scores[playerIdx] += profit;

                if (Scores[playerIdx] < -5 * startingChips)
                    Scores[playerIdx] = -5000 * startingChips;
            }
        }
Ejemplo n.º 6
0
 private static Seat[] CreateSeats(List<IPlayer> players, double startingChips, List<int> playerIndices)
 {
     var seats = new Seat[playerIndices.Count];
     for (int i = 0; i < playerIndices.Count; i++)
         seats[i] = new Seat(i + 1, "Seat" + i + "_Network" + playerIndices[i],
             startingChips, players[playerIndices[i]]);
     return seats;
 }
Ejemplo n.º 7
0
 public TournamentHandHistory(Seat[] players, ulong handNumber, uint button, double[] blinds, double ante, BettingStructure bs)
     : base(players, handNumber, button, blinds, ante, bs)
 {
 }