Files
Shogi/PathFinding/MoveSet.cs
2021-03-04 20:35:23 -06:00

24 lines
617 B
C#

using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace PathFinding
{
public class MoveSet
{
private readonly IPlanarElement element;
private readonly ICollection<Move> moves;
private readonly ICollection<Move> upsidedownMoves;
public MoveSet(IPlanarElement element, ICollection<Move> moves)
{
this.element = element;
this.moves = moves;
upsidedownMoves = moves.Select(_ => new Move(Vector2.Negate(_.Direction), _.Distance)).ToList();
}
public ICollection<Move> GetMoves() => element.IsUpsideDown ? upsidedownMoves : moves;
}
}