예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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;
 }