using Shogi.Domain.Pathing; using System.Collections.ObjectModel; namespace Shogi.Domain.ValueObjects { internal record class Bishop : Piece { private static readonly ReadOnlyCollection BishopPaths = new(new List(4) { new Path(Direction.UpLeft, Distance.MultiStep), new Path(Direction.UpRight, Distance.MultiStep), new Path(Direction.DownLeft, Distance.MultiStep), new Path(Direction.DownRight, Distance.MultiStep) }); public static readonly ReadOnlyCollection PromotedBishopPaths = new(new List(8) { new Path(Direction.Up), new Path(Direction.Left), new Path(Direction.Right), new Path(Direction.Down), new Path(Direction.UpLeft, Distance.MultiStep), new Path(Direction.UpRight, Distance.MultiStep), new Path(Direction.DownLeft, Distance.MultiStep), new Path(Direction.DownRight, Distance.MultiStep) }); public static readonly ReadOnlyCollection Player2Paths = BishopPaths .Select(p => p.Invert()) .ToList() .AsReadOnly(); public static readonly ReadOnlyCollection Player2PromotedPaths = PromotedBishopPaths .Select(p => p.Invert()) .ToList() .AsReadOnly(); public Bishop(WhichPlayer owner, bool isPromoted = false) : base(WhichPiece.Bishop, owner, isPromoted) { } public override IEnumerable MoveSet => IsPromoted ? PromotedBishopPaths : BishopPaths; } }