本文整理汇总了C#中Suit类的典型用法代码示例。如果您正苦于以下问题:C# Suit类的具体用法?C# Suit怎么用?C# Suit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Suit类属于命名空间,在下文中一共展示了Suit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Card
public Card(Suit suit, Value value)
{
this.value = value;
this.suit = suit;
this.name = GetName();
this.owner = null;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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)
}
};
}
示例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)
}
};
}
示例9: Of
public static King Of(Suit suit)
{
return new King
{
_Suit = suit
};
}
示例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)];
}
示例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;
}
示例12: Card
public Card(Suit naipe, int value, bool startClosed)
{
_naipe = naipe;
_value = value;
_isClosed = startClosed;
}
示例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;
}
}
示例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));
}
示例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;
}