本文整理汇总了C#中CardSuit类的典型用法代码示例。如果您正苦于以下问题:C# CardSuit类的具体用法?C# CardSuit怎么用?C# CardSuit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CardSuit类属于命名空间,在下文中一共展示了CardSuit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Card
/// <summary>
/// Initializes a new instance of the Card class.
/// </summary>
/// <param name="CardType">Type of card to create.</param>
/// <param name="CardSuit">Suit of card to create.</param>
public Card(CardType CardType, CardSuit CardSuit)
{
m_Suit = CardSuit;
m_Type = CardType;
m_InternalValue = (int)CardType;
m_IsHigh = true;
}
示例2: Card
public Card(CardSuit suit, CardValue value, Image front, Image back)
{
Suit = suit;
Value = value;
FrontFace = front;
BackFace = back;
}
示例3: CardValueTest
public void CardValueTest(CardValue value1, CardSuit suit1, CardValue value2, CardSuit suit2, int expected)
{
Card card1 = new Card(value1, suit1);
Card card2 = new Card(value2, suit2);
Assert.AreEqual(expected, card1.CompareTo(card2));
}
示例4: GetOpponentCards
public ICollection<Card> GetOpponentCards(ICollection<Card> myCards, ICollection<Card> playedCards, Card activeTrumpCard, CardSuit suit)
{
var playerCards = new CardCollection
{
new Card(suit, CardType.Nine),
new Card(suit, CardType.Jack),
new Card(suit, CardType.Queen),
new Card(suit, CardType.King),
new Card(suit, CardType.Ten),
new Card(suit, CardType.Ace),
};
foreach (var card in myCards.Where(x => x.Suit == suit))
{
playerCards.Remove(card);
}
foreach (var card in playedCards.Where(x => x.Suit == suit))
{
playerCards.Remove(card);
}
if (activeTrumpCard != null)
{
playerCards.Remove(activeTrumpCard);
}
return playerCards;
}
示例5:
// Обращение к карте по ее типу и масти
public Card this[CardType type, CardSuit suit]
{
get
{
return list.Find(c => (c.Type == type) && (c.Suit == suit));
}
}
示例6: Bonus
// Метод создания бонуса - ему присваиваются тип, младшая карта, а также опционно для бонусов типа "последовательность" - масть
public Bonus(BonusType Type, CardType HighCard, bool IsTrump, CardSuit Suit = CardSuit.C_NONE)
{
this.Type = Type;
this.HighCard = HighCard;
this.Suit = Suit;
this.IsTrump = IsTrump;
}
示例7: GetCardWithSuitThatEnemyDoesNotHave
public Card GetCardWithSuitThatEnemyDoesNotHave(bool enemyHasATrumpCard, CardSuit trumpSuit, ICollection<Card> playerCards)
{
if (!enemyHasATrumpCard)
{
// In case the enemy does not have any trump cards and Stalker has a trump, he should throw a trump.
var myTrumpCards = playerCards.Where(c => c.Suit == trumpSuit).ToList();
if (myTrumpCards.Count() > 0)
{
return myTrumpCards.OrderBy(c => c.GetValue()).LastOrDefault();
}
}
var orderedCards = playerCards.OrderBy(c => c.GetValue());
foreach (var card in orderedCards)
{
if (this.cardHolder.EnemyCards.All(c => c.Suit != card.Suit))
{
if (enemyHasATrumpCard)
{
return playerCards.Where(c => c.Suit == card.Suit).OrderBy(c => c.GetValue()).FirstOrDefault();
}
return playerCards.Where(c => c.Suit == card.Suit).OrderByDescending(c => c.GetValue()).FirstOrDefault();
}
}
return null;
}
示例8: Order
public Order(OrderType Type, int Size, CardSuit Trump)
{
this.Type = Type;
this.Size = Size;
this.Trump = Trump;
this.Team = BeloteTeam.TEAM_NONE;
}
示例9: hasSuit
/// <summary>
/// checks the hand if it has the passed suit or not
/// </summary>
/// <param name="suit">Suit of the card to check.</param>
/// <param name="hand">Hand of the player to check in.</param>
/// <returns></returns>
public static bool hasSuit(CardSuit suit, Hand hand)
{
foreach (SpadesCard card in hand.CardPile)
{
if (Card.SuitFromCardIndex(card.CardIndex) == suit) return true;
}
return false;
}
示例10: Card
public Card( int rank, CardSuit suit, CardOrientation orientation = CardOrientation.FaceDown )
{
if ( rank < (int)CardRank.Ace || rank > (int)CardRank.King )
{
throw new ArgumentException( "Invalid card rank" );
}
InitCard( (CardRank) rank, suit, orientation );
}
示例11: GetFailureProbabilityForSuit
private double GetFailureProbabilityForSuit(int cards, int discards, CardSuit suit)
{
int cardSet = BitwiseCardHelper.GetCardSet(cards, suit);
int discardsCount = BitwiseCardHelper.GetSuitCount(discards, suit);
int otherSuitsDistribution = CardSuitDistribution.GetDistribution(cards, discards, suit);
return MisereProbabilities.GetFailureProbability(cardSet, discardsCount, otherSuitsDistribution, IsFirstHand);
}
示例12: Of
public static ICard Of(CardSuit cardSuit)
{
var king = new King
{
_CardSuit = cardSuit
};
return king;
}
示例13: Of
public static ICard Of(CardSuit cardSuit)
{
var jack = new Jack
{
_CardSuit = cardSuit
};
return jack;
}
示例14: Card
public Card(CardSuit suit, CardRank rank, Image frontImage) : this(suit, rank)
{
this.FrontImage = frontImage;
//Can we make it to private readonly or const?
this.BackCardPath = "..\\..\\Resources\\Cards\\Back.png";
this.BackImage = Image.FromFile(BackCardPath);
this.CardPictureBox = new PictureBox();
}
示例15: ChangeTrumpCardTest
public void ChangeTrumpCardTest(CardSuit suit, CardType type)
{
var newCard = new Card(suit, type);
var deck = new Deck();
deck.ChangeTrumpCard(newCard);
Assert.AreNotEqual(0, deck.CardsLeft, "Change card doesn't work");
}