using Shogi.Domain.Pathing; using System.Collections.ObjectModel; namespace Shogi.Domain.Pieces { internal class SilverGeneral : Piece { public static readonly ReadOnlyCollection Player1Paths = new(new List(4) { new Path(Direction.Up), new Path(Direction.UpLeft), new Path(Direction.UpRight), new Path(Direction.DownLeft), new Path(Direction.DownRight) }); public static readonly ReadOnlyCollection Player2Paths = Player1Paths .Select(p => p.Invert()) .ToList() .AsReadOnly(); public SilverGeneral(WhichPlayer owner, bool isPromoted = false) : base(WhichPiece.SilverGeneral, owner, isPromoted) { } public override ReadOnlyCollection MoveSet => Owner switch { WhichPlayer.Player1 => IsPromoted ? GoldGeneral.Player1Paths : Player1Paths, WhichPlayer.Player2 => IsPromoted ? GoldGeneral.Player2Paths : Player2Paths, _ => throw new NotImplementedException(), }; } }