Skip to content

Commit edc4d3b

Browse files
LionHawjuliani
authored andcommitted
Update Ball3DDecision.cs (#218)
I think it is important to add a simple heuristic example to demonstrate how to implement a Decision
1 parent 63373b5 commit edc4d3b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,24 @@ public float[] Decide(List<float> state, List<Camera> observation, float reward,
88
{
99
if (gameObject.GetComponent<Brain>().brainParameters.actionSpaceType == StateType.continuous)
1010
{
11-
return new float[4]{ 0f, 0f, 0f, 0.0f };
11+
List<float> ret = new List<float>();
12+
if (state[2] < 0 || state[5] < 0)
13+
{
14+
ret.Add(state[5]);
15+
}
16+
else
17+
{
18+
ret.Add(state[5]);
19+
}
20+
if (state[3] < 0 || state[7] < 0)
21+
{
22+
ret.Add(-state[7]);
23+
}
24+
else
25+
{
26+
ret.Add(-state[7]);
27+
}
28+
return ret.ToArray();
1229

1330
}
1431
else

0 commit comments

Comments
 (0)