static IEnumerable <IntegerVector2> GetPath(IntegerVector2 from, IntegerVector2 to, bool isFrontPlayersPiece, PieceMovement pieceMovement) { IntegerVector2 relativePosition = (to - from) * (isFrontPlayersPiece ? -1 : 1); var result = pieceMovement.GetPath(relativePosition); Assert.IsNotNull(result); return(result); }
public void Case2() { PieceMovement pieceMovement = new PieceMovement(new IntegerVector2(0, 1), -1); for (int i = 1; i <= 10; i++) { Assert.IsNotNull(pieceMovement.GetPath(new IntegerVector2(0, i))); } Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(0, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, -1))); }
public void Case1() { PieceMovement pieceMovement = new PieceMovement(new IntegerVector2(0, 1), 1); Assert.IsNotNull(pieceMovement.GetPath(new IntegerVector2(0, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(0, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-2, 2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, 2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(0, 2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, 2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(2, 2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-2, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(2, 1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-2, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(2, 0))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-2, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(2, -1))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-2, -2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(-1, -2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(0, -2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(1, -2))); Assert.IsNull(pieceMovement.GetPath(new IntegerVector2(2, -2))); }