本文整理汇总了C#中Poker.Hand.addCard方法的典型用法代码示例。如果您正苦于以下问题:C# Hand.addCard方法的具体用法?C# Hand.addCard怎么用?C# Hand.addCard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poker.Hand
的用法示例。
在下文中一共展示了Hand.addCard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
// Two Hands
Hand black = new Hand();
Hand white = new Hand();
string input;
//while ((input = Console.ReadLine()) != null) {
// TODO: REMOVE THIS
input = "2H 3D 5S 9C KD 2C 3H 4S AD AH"; // High Card, Pair
//input = "2H 3D 4H 5D 6H 3C 4C 5C 6C 7C"; // Straight, Straight Flush
//input = "2H 2D 3H 3D 4C AH AD TC TD TH"; // Two Pair, Full House (Correctly does 10)
//input = "2H 2D 2C 4H 5H AH AD AC AS KD"; // 3Kind, 4Kind
//input = "2H 4H 6H 8H TH 2D 4D 6D 8D TD"; // Flush (Tie)s
// No More Input (hackish way to detect end of input??)
//if (input.Length < 2) {
// break;
//}
// Parse and load Hands
string[] cardStrings = input.Split(' ');
for (int i = 0; i < Hand.Limit; ++i) {
black.addCard(new Card(cardStrings[i]));
}
for (int i = 0; i < Hand.Limit; ++i) {
white.addCard(new Card(cardStrings[i+Hand.Limit]));
}
// Get the Score for Each Hand
Score blackScore = black.Score;
Score whiteScore = white.Score;
Console.WriteLine(blackScore.ToString());
Console.WriteLine(whiteScore.ToString());
int compare = blackScore.CompareTo(whiteScore);
if (compare == 0) {
Console.WriteLine("Tie.");
} else if (compare < 0) {
Console.WriteLine("White wins.");
} else {
Console.WriteLine("Black wins.");
}
// TODO: REMOVE THIS
//break;
//}
Console.WriteLine("Hello World!");
}