mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Mostly finished implementation of the new deck? ALso added some tests
This commit is contained in:
17
src/Nadeko.Econ/Deck/Regular/RegularCard.cs
Normal file
17
src/Nadeko.Econ/Deck/Regular/RegularCard.cs
Normal 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();
|
||||
}
|
5
src/Nadeko.Econ/Deck/Regular/RegularDeck.cs
Normal file
5
src/Nadeko.Econ/Deck/Regular/RegularDeck.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Nadeko.Econ;
|
||||
|
||||
public sealed class RegularDeck : NewDeck<RegularCard, RegularSuit, RegularValue>
|
||||
{
|
||||
}
|
9
src/Nadeko.Econ/Deck/Regular/RegularSuit.cs
Normal file
9
src/Nadeko.Econ/Deck/Regular/RegularSuit.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Nadeko.Econ;
|
||||
|
||||
public enum RegularSuit
|
||||
{
|
||||
Hearts,
|
||||
Diamonds,
|
||||
Clubs,
|
||||
Spades
|
||||
}
|
18
src/Nadeko.Econ/Deck/Regular/RegularValue.cs
Normal file
18
src/Nadeko.Econ/Deck/Regular/RegularValue.cs
Normal 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,
|
||||
}
|
Reference in New Issue
Block a user