Code smells

This commit is contained in:
2021-03-04 20:35:23 -06:00
parent e64f75e3cc
commit 7ed771d467
31 changed files with 310 additions and 339 deletions

23
PathFinding/MoveSet.cs Normal file
View File

@@ -0,0 +1,23 @@
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;
}
}