本文整理汇总了C#中Suit类的典型用法代码示例。如果您正苦于以下问题:C# Suit类的具体用法?C# Suit怎么用?C# Suit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Suit类属于命名空间,在下文中一共展示了Suit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Card
public Card(Suit suit, Value value)
{
this.value = value;
this.suit = suit;
this.name = GetName();
this.owner = null;
}
开发者ID:AKorshunov87,项目名称:SimplePoker,代码行数:7,代码来源:Card.cs
示例2: TestTricks
private static List<Trick> TestTricks(Suit trump, Seat declarer)
{
//D = declarer's team, d = defender's team
var tricks = new List<Trick>(13);
Seat lead = declarer.GetNextSeat(); //Lead:d, Win: D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.TwoOfClubs, Deck.FiveOfClubs, Deck.FourOfClubs, Deck.ThreeOfClubs}));
lead = lead.GetNextSeat(); // Lead:D, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.EightOfClubs, Deck.NineOfClubs, Deck.SevenOfClubs, Deck.SixOfClubs}));
lead = lead.GetNextSeat(); // Lead:d, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.AceOfClubs, Deck.KingOfClubs, Deck.QueenOfClubs, Deck.JackOfClubs}));
//lead = lead.GetNextSeat(); // Lead:d, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.TenOfClubs, Deck.TwoOfDiamonds, Deck.ThreeOfDiamonds, Deck.FourOfDiamonds}));
//lead = lead.GetNextSeat(); // Lead:d, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.FiveOfDiamonds, Deck.EightOfDiamonds, Deck.SixOfDiamonds, Deck.SevenOfDiamonds}));
lead = lead.GetNextSeat(); // Lead:D, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.KingOfDiamonds, Deck.QueenOfDiamonds, Deck.JackOfDiamonds, Deck.TenOfDiamonds}));
//lead = lead.GetNextSeat(); // Lead:D, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.TwoOfHearts, Deck.FourOfHearts, Deck.AceOfDiamonds, Deck.ThreeOfHearts}));
lead = lead.GetNextSeat(); // Lead:d, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.FiveOfHearts, Deck.EightOfHearts, Deck.SixOfHearts, Deck.SevenOfHearts}));
lead = lead.GetNextSeat(); // Lead:D, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.NineOfHearts, Deck.QueenOfHearts, Deck.TenOfHearts, Deck.JackOfHearts}));
lead = lead.GetNextSeat(); // Lead:d, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.KingOfHearts, Deck.AceOfHearts, Deck.AceOfSpades, Deck.KingOfSpades}));
lead = lead.GetNextSeat(); // Lead:D, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.NineOfDiamonds, Deck.QueenOfSpades, Deck.JackOfSpades, Deck.TenOfSpades}));
//lead = lead.GetNextSeat(); // Lead:D, Win:d
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.EightOfSpades, Deck.NineOfSpades, Deck.SevenOfSpades, Deck.SixOfSpades}));
lead = lead.GetNextSeat(); // Lead:d, Win:D
tricks.Add(Trick.FromCards(trump, lead, new[] {Deck.FourOfSpades, Deck.FiveOfSpades, Deck.ThreeOfSpades, Deck.TwoOfSpades}));
//Score D: 7, d: 6
return tricks;
}
开发者ID:rsarwas,项目名称:BridgeIt,代码行数:33,代码来源:Main.cs
示例3: button1_Click
private void button1_Click(object sender, EventArgs e)
{
mySuit = (Suit)random.Next(4);
myValue = (Value)random.Next(1,14);
myCard = new Card(mySuit, myValue);
MessageBox.Show(myCard.Name);
}
开发者ID:bobbyquennell,项目名称:csharpstudy,代码行数:7,代码来源:Form1.cs
示例4: Suits_Should_Have_13_Cards
public void Suits_Should_Have_13_Cards(Suit suit)
{
var aDeck = new Deck();
var i = aDeck.Cards.Count(x => x.GetCardSuit() == suit);
Assert.AreEqual(i,13);
}
开发者ID:rHarris213,项目名称:PokerGame,代码行数:7,代码来源:TestClass.cs
示例5: RequestBid
public override Bid? RequestBid()
{
//BUG BUG BUG..... where do you clean this (FGS) for the second round?!?!?! will always have the value of last bid!!! BUG BUG BUG
//if (m_highestBid == -1)
//{
m_highestBid = Math.Round(GetHighestBid(this.Cards));
m_highestBidSuit = GetHighestBidSuit();
//}
// bid is ICompareable !! this means you can sort by simply the bid rather than implement comparing
Bid? currHighestBidObj = (from b in this.CurrentRoundStatus.Biddings
where b != null
orderby b.Value descending
select b.Value).FirstOrDefault();
Bid myHighestBid = new Bid { Amount = (int)m_highestBid, Suit = m_highestBidSuit };
// each bidding round the minimum grows by one : 5 , 6 , 7
if (myHighestBid.Amount >= (5 + this.CurrentRoundStatus.TurnNumber))
{
// if there is no heighest bid or my bid is heigher than the highest one
if( !currHighestBidObj.HasValue || myHighestBid > currHighestBidObj.Value)
{
return myHighestBid;
}
}
return null;
}
开发者ID:MaozGelbart,项目名称:cs-whist-2010,代码行数:29,代码来源:SmartBidder.cs
示例6: Main
static void Main(string[] args)
{
Person xc = new Person("Small bird");
Console.WriteLine("\nThe first decorated type: ");
Finery dtx = new TShirts();
Finery kk = new BigTrouser();
Finery pqx = new Sneakers();
dtx.Show();
kk.Show();
pqx.Show();
xc.Show();
Console.WriteLine("\nThe second decorated type: ");
Finery xz = new Suit();
Finery ld = new Tie();
Finery px = new LeatherShoes();
xz.Show();
ld.Show();
px.Show();
xc.Show();
}
开发者ID:yuliang136,项目名称:BigwordOfFirstHead,代码行数:26,代码来源:Program.cs
示例7: CreateHandFromFirstNineCardsOfGivenSuit
protected Hand CreateHandFromFirstNineCardsOfGivenSuit(Suit suit)
{
return new Hand
{
FaceDownCards = new List<Card>
{
new Card(suit, Rank.Ace),
new Card(suit, Rank.Two),
new Card(suit, Rank.Three)
},
FaceUpCards = new List<Card>
{
new Card(suit, Rank.Four),
new Card(suit, Rank.Five),
new Card(suit, Rank.Six)
},
InHandCards = new List<Card>
{
new Card(suit, Rank.Seven),
new Card(suit, Rank.Eight),
new Card(suit, Rank.Nine)
}
};
}
开发者ID:Roonerelli,项目名称:Shithead,代码行数:25,代码来源:BaseGameTest.cs
示例8: CreateHandWithSpecificInHandCards
protected Hand CreateHandWithSpecificInHandCards(Suit suit, Card cardOne, Card cardTwo, Card cardThree)
{
return new Hand
{
FaceDownCards = new List<Card>
{
cardOne,
cardTwo,
cardThree
},
FaceUpCards = new List<Card>
{
new Card(suit, Rank.Four),
new Card(suit, Rank.Five),
new Card(suit, Rank.Six)
},
InHandCards = new List<Card>
{
new Card(suit, Rank.Seven),
new Card(suit, Rank.Eight),
new Card(suit, Rank.Nine)
}
};
}
开发者ID:Roonerelli,项目名称:Shithead,代码行数:25,代码来源:BaseGameTest.cs
示例9: Of
public static King Of(Suit suit)
{
return new King
{
_Suit = suit
};
}
开发者ID:tekavec,项目名称:OhHellKata,代码行数:7,代码来源:King.cs
示例10: ComputerDoMove
public Card ComputerDoMove(Card fieldCard, Suit troef)
{
List<Card> lstAllowedCards = GetAllowedCards(fieldCard, troef);
Random random = new Random();
return lstAllowedCards[random.Next(0, lstAllowedCards.Count - 1)];
}
开发者ID:Deweer,项目名称:ManillenWPhone,代码行数:7,代码来源:ComputerPlayer.cs
示例11: Has
/// <summary>
/// Determines whether [has] [the specified rank].
/// </summary>
/// <param name="rank">The rank.</param>
/// <param name="suit">The suit.</param>
/// <returns>
/// <c>true</c> if [has] [the specified rank]; otherwise, <c>false</c>.
/// </returns>
public bool Has(Rank rank, Suit suit)
{
if (GetCard(rank, suit) != null)
return true;
else
return false;
}
开发者ID:anorsich,项目名称:dds.net,代码行数:15,代码来源:Deck.cs
示例12: Card
public Card(Suit naipe, int value, bool startClosed)
{
_naipe = naipe;
_value = value;
_isClosed = startClosed;
}
开发者ID:rcarubbi,项目名称:Carubbi.Cards,代码行数:7,代码来源:Card.cs
示例13: Card
public Card(int input)
{
integerValue = input;
int tempValue = input % 13;
int tempSuit = input / 13;
switch (tempValue)
{
case 0: value = Value.ACE; break;
case 1: value = Value.TWO; break;
case 2: value = Value.THREE; break;
case 3: value = Value.FOUR; break;
case 4: value = Value.FIVE; break;
case 5: value = Value.SIX; break;
case 6: value = Value.SEVEN; break;
case 7: value = Value.EIGHT; break;
case 8: value = Value.NINE; break;
case 9: value = Value.TEN; break;
case 10: value = Value.JACK; break;
case 11: value = Value.QUEEN; break;
case 12: value = Value.KING; break;
}
switch (tempSuit)
{
case 0: suit = Suit.SPADES; break;
case 1: suit = Suit.HEARTS; break;
case 2: suit = Suit.DIAMONDS; break;
case 3: suit = Suit.CLUBS; break;
}
}
开发者ID:Camzace,项目名称:ZacesCasino,代码行数:31,代码来源:Card.cs
示例14: IsCardAlreadyDealt
private bool IsCardAlreadyDealt(Suit suit, Value value)
{
List<PlayingCard> cardsInSuit = this.cardPack[suit];
// oh god it's like programming in Scala all over again ;_;
return (!cardsInSuit.Exists(c => c.CardSuit == suit && c.CardValue == value));
}
开发者ID:Zyst,项目名称:C-Learning,代码行数:7,代码来源:Pack.cs
示例15: Deck
/// <summary>
/// Nondefault constructor. Allows aces to be set high and a trump suit
/// to be used.
/// </summary>
public Deck(bool isAceHigh, bool useTrumps, Suit trump)
: this()
{
Card.isAceHigh = isAceHigh;
Card.useTrumps = useTrumps;
Card.trump = trump;
}
开发者ID:ktjones,项目名称:BVCS2012,代码行数:11,代码来源:Deck.cs
示例16: SwapSuitWith
public Game SwapSuitWith(Suit suit)
{
var cards = this.hand.Cards.Select(c =>
Fun.SwapSuit(c, suit)).ToArray();
return new Game(cards[0], cards[1], cards[2], cards[3], cards[4]);
}
开发者ID:rafanoronha,项目名称:poco-poker,代码行数:7,代码来源:GameBuilder.cs
示例17: Trick
public Trick(Suit trump)
{
Trump = trump;
_cards = new List<Card>(4);
_players = new List<Seat>(4);
Suit = Suit.None;
}
开发者ID:rsarwas,项目名称:BridgeIt,代码行数:7,代码来源:Trick.cs
示例18: GetCardsForSuit
private IEnumerable<Card> GetCardsForSuit(Suit suit)
{
var listOfCardTypes = new List<CardType>();
listOfCardTypes.AddRange(new CardType[]
{
CardType.Ace,
CardType.Two,
CardType.Three,
CardType.Four,
CardType.Five,
CardType.Six,
CardType.Seven,
CardType.Eight,
CardType.Nine,
CardType.Ten,
CardType.Jack,
CardType.Queen,
CardType.King,
});
return listOfCardTypes.Select(cardType => new Card()
{
Name = string.Format("{0} of {1}s", cardType, suit.ToString()),
Value = GetPointsForCardType(cardType) + GetExtraPointsForSuit(suit),
CardType = cardType
});
}
开发者ID:kotsaris,项目名称:katas,代码行数:26,代码来源:Deck.cs
示例19: WhenCardIsConstructedWithShortNotation
public void WhenCardIsConstructedWithShortNotation(string shortNotation, Value expectedValue, Suit expectedSuit)
{
var card = new Card(shortNotation);
Assert.That(card.Value, Is.EqualTo(expectedValue));
Assert.That(card.Suit, Is.EqualTo(expectedSuit));
}
开发者ID:lordjeb,项目名称:kata-pokerhands,代码行数:7,代码来源:CardTests.cs
示例20: Card
public Card(Value value, Suit suit)
{
if (value < (Value)6) value = (Value)6;
if (value > Value.A) value = Value.A;
this.value = value;
this.suit = suit;
}
开发者ID:VladasZ,项目名称:Homework,代码行数:7,代码来源:Card.cs
注:本文中的Suit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论