1
1
using NUnit . Framework ;
2
2
using Roy_T . AStar . Graphs ;
3
+ using Roy_T . AStar . Grids ;
3
4
using Roy_T . AStar . Paths ;
4
5
using Roy_T . AStar . Primitives ;
5
6
@@ -14,6 +15,43 @@ public PathFinderTests()
14
15
this . PathFinder = new PathFinder ( ) ;
15
16
}
16
17
18
+
19
+ [ Test ]
20
+ public void Issue50 ( )
21
+ {
22
+ var columns = 21 ;
23
+ var rows = 21 ;
24
+ var start = new GridPosition ( 0 , 20 ) ;
25
+ var end = new GridPosition ( 16 , 2 ) ;
26
+
27
+ var grid = Grid . CreateGridWithLateralAndDiagonalConnections ( new GridSize ( columns , rows ) , new Size ( Distance . FromMeters ( 1 ) , Distance . FromMeters ( 1 ) ) , Velocity . FromMetersPerSecond ( 1.0f ) ) ;
28
+
29
+ grid . DisconnectNode ( new GridPosition ( 7 , 3 ) ) ;
30
+ grid . DisconnectNode ( new GridPosition ( 8 , 3 ) ) ;
31
+ grid . DisconnectNode ( new GridPosition ( 9 , 3 ) ) ;
32
+ grid . DisconnectNode ( new GridPosition ( 10 , 3 ) ) ;
33
+ grid . DisconnectNode ( new GridPosition ( 11 , 3 ) ) ;
34
+ grid . DisconnectNode ( new GridPosition ( 12 , 3 ) ) ;
35
+ grid . DisconnectNode ( new GridPosition ( 13 , 3 ) ) ;
36
+ grid . DisconnectNode ( new GridPosition ( 14 , 3 ) ) ;
37
+
38
+ grid . DisconnectNode ( new GridPosition ( 14 , 4 ) ) ;
39
+ grid . DisconnectNode ( new GridPosition ( 14 , 5 ) ) ;
40
+ grid . DisconnectNode ( new GridPosition ( 14 , 6 ) ) ;
41
+ grid . DisconnectNode ( new GridPosition ( 14 , 7 ) ) ;
42
+ grid . DisconnectNode ( new GridPosition ( 14 , 8 ) ) ;
43
+ grid . DisconnectNode ( new GridPosition ( 14 , 9 ) ) ;
44
+ grid . DisconnectNode ( new GridPosition ( 14 , 10 ) ) ;
45
+ grid . DisconnectNode ( new GridPosition ( 14 , 11 ) ) ;
46
+ grid . DisconnectNode ( new GridPosition ( 14 , 12 ) ) ;
47
+
48
+ var pathA = this . PathFinder . FindPath ( start , end , grid ) ;
49
+ Assert . That ( pathA . Edges . Count < 32 ) ;
50
+
51
+ var pathB = this . PathFinder . FindPath ( end , start , grid ) ;
52
+ Assert . That ( pathB . Edges . Count < 32 ) ;
53
+ }
54
+
17
55
[ Test ]
18
56
public void ShouldFindPath__StartNodeIsEndNode ( )
19
57
{
0 commit comments