From 17331d7fe3ddd740c378f2b53f8adb481f5a5957 Mon Sep 17 00:00:00 2001 From: LionH Date: Thu, 28 Dec 2017 17:00:17 +0100 Subject: [PATCH] Update Ball3DDecision.cs I think it is important to add a simple heuristic example to demonstrate how to implement a Decision --- .../Examples/3DBall/Scripts/Ball3DDecision.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs b/unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs index 3700c21352..ac1faa5966 100755 --- a/unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs +++ b/unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs @@ -8,7 +8,24 @@ public float[] Decide(List state, List observation, float reward, { if (gameObject.GetComponent().brainParameters.actionSpaceType == StateType.continuous) { - return new float[4]{ 0f, 0f, 0f, 0.0f }; + List ret = new List(); + if (state[2] < 0 || state[5] < 0) + { + ret.Add(state[5]); + } + else + { + ret.Add(state[5]); + } + if (state[3] < 0 || state[7] < 0) + { + ret.Add(-state[7]); + } + else + { + ret.Add(-state[7]); + } + return ret.ToArray(); } else