51 lines
865 B
C#
51 lines
865 B
C#
namespace MauMau_Server.Mau;
|
|
|
|
public class Card
|
|
{
|
|
public readonly CardType CardType;
|
|
public readonly CardValue CardValue;
|
|
|
|
public Card(CardType cardType, CardValue cardValue)
|
|
{
|
|
CardType = cardType;
|
|
CardValue = cardValue;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{CardType} {CardValue}";
|
|
}
|
|
|
|
public Card parseCard(string card)
|
|
{
|
|
var cardType = card.Split(" ")[0];
|
|
var cardValue = card.Split(" ")[1];
|
|
return new Card((CardType)Enum.Parse(typeof(CardType), cardType),
|
|
(CardValue)Enum.Parse(typeof(CardValue), cardValue));
|
|
}
|
|
}
|
|
|
|
public enum CardType
|
|
{
|
|
SPADES,
|
|
HEARTS,
|
|
DIAMONDS,
|
|
CLUBS
|
|
}
|
|
|
|
public enum CardValue
|
|
{
|
|
TWO,
|
|
THREE,
|
|
FOUR,
|
|
FIVE,
|
|
SIX,
|
|
SEVEN,
|
|
EIGHT,
|
|
NINE,
|
|
TEN,
|
|
JACK,
|
|
QUEEN,
|
|
KING,
|
|
ACE
|
|
} |