コード例 #1
0
ファイル: Driver.cs プロジェクト: cwoidyla/DevelopmentiOS
 private static void HandTest() {
     Deck d = new Deck();
     Card[] pocket = { d.Draw(), d.Draw() };
     Card[] community = { d.Draw(), d.Draw(), d.Draw(), d.Draw(), d.Draw() };
     Console.WriteLine("{0}\n{1}", String.Join("\n", pocket.Select(card => card.ToString())),
         String.Join("\n", community.Select(card => card.ToString())));
     Console.WriteLine(
         new Hand(String.Join(" ", pocket.Select(card => card.Serialize(true))),
             String.Join(" ", community.Select(card => card.Serialize(true)))).Description);
 }
コード例 #2
0
ファイル: Driver.cs プロジェクト: cwoidyla/DevelopmentiOS
 private static void TestGame() {
     Deck d = new Deck();
     Player p = new Player("Robot1", "Robot1");
     Player q = new Player("Robot2", "Robot2");
     p.SetPocket(d.Draw(), d.Draw());
     q.SetPocket(d.Draw(), d.Draw());
     Card[] community = { d.Draw(), d.Draw(), d.Draw(), d.Draw(), d.Draw() };
     Console.WriteLine(p.FindBestHand(SerializeCommunity(community)).Description);
     Console.WriteLine(q.FindBestHand(SerializeCommunity(community)).Description);
 }
コード例 #3
0
ファイル: Driver.cs プロジェクト: cwoidyla/DevelopmentiOS
 private static int DeckTest() {
     Deck d = new Deck();
     Card drawn;
     bool[,] exist = new bool[4,13];
     int count = 0;
     while (!d.IsEmpty) {
         drawn = d.Draw();
         exist[drawn.Suit, drawn.Rank] = true;
         count++;
     }
     for (int i = 0; i < 4; i++) {
         for (int j = 0; j < 13; j++) {
             if (!exist[i, j]) {
                 Console.WriteLine("ERROR MISSING CARD: {0}{1}", i, j);
             }
         }
     }
     Console.WriteLine("{0} cards drawn", count);
     return 0;
 }
コード例 #4
0
 private void InitVars() {
     this.pot = 0;
     this.deck = new Deck();
     this.round = Round.Preflop;
     this.lastAct = "A new hand has been dealt";
     Array.Clear(this.community, 0, this.community.Length);
     foreach (Player p in this.players) {
         p.Folded = false;
         p.Bet = 0;
         this.needToAct.Enqueue(p);
     }
 }