@@ -14,13 +14,13 @@ public InspirationalBranch(Solver solver)
14
14
{
15
15
this . solver = solver ;
16
16
17
- Inspirational = solver . AvailableInspirationals [ Helper . GetInt ( solver . AvailableInspirationals . Length ) ] ;
17
+ Inspirational = solver . AvailableInspirationals [ solver . RandomHelper . GetShort ( solver . AvailableInspirationals . Length ) ] ;
18
18
}
19
19
20
20
public InspirationalBranch CreateRandomNode ( )
21
21
{
22
22
var newNode = new InspirationalBranch ( solver ) ;
23
- newNode . Inspirational = solver . AvailableInspirationals [ Helper . GetInt ( solver . AvailableInspirationals . Length ) ] ;
23
+ newNode . Inspirational = solver . AvailableInspirationals [ solver . RandomHelper . GetShort ( solver . AvailableInspirationals . Length ) ] ;
24
24
25
25
return newNode ;
26
26
}
@@ -43,32 +43,32 @@ public IEnumerable<string> GetNames()
43
43
44
44
public void Mutate ( )
45
45
{
46
- if ( Helper . Mutate ( 100 ) )
46
+ if ( solver . RandomHelper . Mutate ( 100 ) )
47
47
{
48
- Inspirational = solver . AvailableInspirationals [ Helper . GetInt ( solver . AvailableInspirationals . Length ) ] ;
48
+ Inspirational = solver . AvailableInspirationals [ solver . RandomHelper . GetShort ( solver . AvailableInspirationals . Length ) ] ;
49
49
}
50
50
51
51
if ( LeftNode != null ) LeftNode . Mutate ( ) ;
52
52
if ( RightNode != null ) RightNode . Mutate ( ) ;
53
53
54
54
if ( LeftNode == null )
55
55
{
56
- if ( Helper . Mutate ( 20 ) ) LeftNode = CreateRandomNode ( ) ;
57
- else if ( Helper . Mutate ( 20 ) ) LeftNode = this . Clone ( ) ;
56
+ if ( solver . RandomHelper . Mutate ( 20 ) ) LeftNode = CreateRandomNode ( ) ;
57
+ else if ( solver . RandomHelper . Mutate ( 20 ) ) LeftNode = this . Clone ( solver ) ;
58
58
}
59
59
else
60
60
{
61
- if ( Helper . Mutate ( 50 ) ) LeftNode = null ;
61
+ if ( solver . RandomHelper . Mutate ( 50 ) ) LeftNode = null ;
62
62
}
63
63
64
64
if ( RightNode == null )
65
65
{
66
- if ( Helper . Mutate ( 20 ) ) RightNode = CreateRandomNode ( ) ;
67
- else if ( Helper . Mutate ( 20 ) ) RightNode = this . Clone ( ) ;
66
+ if ( solver . RandomHelper . Mutate ( 20 ) ) RightNode = CreateRandomNode ( ) ;
67
+ else if ( solver . RandomHelper . Mutate ( 20 ) ) RightNode = this . Clone ( solver ) ;
68
68
}
69
69
else
70
70
{
71
- if ( Helper . Mutate ( 50 ) ) RightNode = null ;
71
+ if ( solver . RandomHelper . Mutate ( 50 ) ) RightNode = null ;
72
72
}
73
73
}
74
74
@@ -83,13 +83,13 @@ public void Evaluate(EvaluationState engine)
83
83
}
84
84
}
85
85
86
- public InspirationalBranch Clone ( )
86
+ public InspirationalBranch Clone ( Solver solver )
87
87
{
88
88
InspirationalBranch clone = new InspirationalBranch ( solver ) ;
89
89
clone . Inspirational = Inspirational ;
90
90
91
- if ( LeftNode != null ) clone . LeftNode = LeftNode . Clone ( ) ;
92
- if ( RightNode != null ) clone . RightNode = RightNode . Clone ( ) ;
91
+ if ( LeftNode != null ) clone . LeftNode = LeftNode . Clone ( solver ) ;
92
+ if ( RightNode != null ) clone . RightNode = RightNode . Clone ( solver ) ;
93
93
94
94
return clone ;
95
95
}
@@ -102,7 +102,7 @@ public InspirationalBranch GetRandomNode()
102
102
var nodes = new List < InspirationalBranch > ( ) ;
103
103
TraverseNode ( this , nodes ) ;
104
104
105
- var index = Helper . GetInt ( nodes . Count ) ;
105
+ var index = solver . RandomHelper . GetShort ( nodes . Count ) ;
106
106
return nodes [ index ] ;
107
107
}
108
108
0 commit comments