Mostly finished implementation of the new deck? ALso added some tests

This commit is contained in:
Kwoth
2022-07-21 06:55:15 +02:00
parent 9a21ba3d53
commit c8c0b27d6a
10 changed files with 167 additions and 37 deletions

View File

@@ -0,0 +1,17 @@
namespace Nadeko.Econ;
public sealed class RegularCard : NewCard<RegularSuit, RegularValue>
{
public RegularCard(RegularSuit suit, RegularValue value) : base(suit, value)
{
}
private bool Equals(RegularCard other)
=> other.Suit == this.Suit && other.Value == this.Value;
public override bool Equals(object? obj)
=> ReferenceEquals(this, obj) || obj is RegularCard other && Equals(other);
public override int GetHashCode()
=> Suit.GetHashCode() * 17 + Value.GetHashCode();
}

View File

@@ -0,0 +1,5 @@
namespace Nadeko.Econ;
public sealed class RegularDeck : NewDeck<RegularCard, RegularSuit, RegularValue>
{
}

View File

@@ -0,0 +1,9 @@
namespace Nadeko.Econ;
public enum RegularSuit
{
Hearts,
Diamonds,
Clubs,
Spades
}

View File

@@ -0,0 +1,18 @@
namespace Nadeko.Econ;
public enum RegularValue
{
A = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8,
Nine = 9,
Ten = 10,
Jack = 12,
Queen = 13,
King = 14,
}