Position NextInLine(Position hitPos) { lock (_lock) { return(IfIsInLine(hitPos.Above(1), hitPos.Above(2)) ?? IfIsInLine(hitPos.Below(1), hitPos.Below(2)) ?? IfIsInLine(hitPos.Left(1), hitPos.Left(2)) ?? IfIsInLine(hitPos.Right(1), hitPos.Right(2))); } }
Position NextEmptyPositionAround(Position hitPos) { lock (_lock) { return(IfIsOpenPosition(hitPos.Above(1)) ?? IfIsOpenPosition(hitPos.Below(1)) ?? IfIsOpenPosition(hitPos.Left(1)) ?? IfIsOpenPosition(hitPos.Right(1))); } }
public void CalculatePositionAbove() { _position.Above().Should().Be(new Position(3, 2)); }