| | 1 | | using System; |
| | 2 | | namespace Rudim.Common |
| | 3 | | { |
| 160255449 | 4 | | public record MoveType(int Value, Piece Piece = Piece.None, string PromotionChar = "", bool IsCapture = false) |
| | 5 | | { |
| 32208225 | 6 | | public virtual bool Equals(MoveType other) => other?.Value == Value; |
| 0 | 7 | | public override int GetHashCode() => HashCode.Combine(Value); |
| | 8 | | } |
| | 9 | |
|
| | 10 | | public static class MoveTypes |
| | 11 | | { |
| | 12 | | public static MoveType Quiet { get; } = new(0); |
| | 13 | | public static MoveType Capture { get; } = new(1, Piece.None, null, true); |
| | 14 | | public static MoveType EnPassant { get; } = new(2, Piece.None, null, true); |
| | 15 | | public static MoveType DoublePush { get; } = new(3, Piece.None); |
| | 16 | | public static MoveType KnightPromotion { get; } = new(4, Piece.Knight, "n"); |
| | 17 | | public static MoveType BishopPromotion { get; } = new(5, Piece.Bishop, "b"); |
| | 18 | | public static MoveType RookPromotion { get; } = new(6, Piece.Rook, "r"); |
| | 19 | | public static MoveType QueenPromotion { get; } = new(7, Piece.Queen, "q"); |
| | 20 | | public static MoveType KnightPromotionCapture { get; } = new(12, Piece.Knight, "n", true); |
| | 21 | | public static MoveType BishopPromotionCapture { get; } = new(13, Piece.Bishop, "b", true); |
| | 22 | | public static MoveType RookPromotionCapture { get; } = new(14, Piece.Rook, "r", true); |
| | 23 | | public static MoveType QueenPromotionCapture { get; } = new(15, Piece.Queen, "q", true); |
| | 24 | | public static MoveType Castle { get; } = new(16); |
| | 25 | | } |
| | 26 | | } |