Skip to content

Commit f020ecc

Browse files
author
Ervin Teng
committed
Merge master into develop-single-config
2 parents c80c359 + 82aec24 commit f020ecc

File tree

76 files changed

+2262
-1895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2262
-1895
lines changed

Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBall.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBallHard.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ public override void OnEpisodeBegin()
6666
SetResetParameters();
6767
}
6868

69-
public override float[] Heuristic()
69+
public override void Heuristic(float[] actionsOut)
7070
{
71-
var action = new float[2];
72-
73-
action[0] = -Input.GetAxis("Horizontal");
74-
action[1] = Input.GetAxis("Vertical");
75-
return action;
71+
actionsOut[0] = -Input.GetAxis("Horizontal");
72+
actionsOut[1] = Input.GetAxis("Vertical");
7673
}
7774

7875
public void SetBall()

Project/Assets/ML-Agents/Examples/Basic/Demos/ExpertBasic.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/Bouncer/Demos/ExpertBouncer.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,11 @@ void FixedUpdate()
102102
}
103103
}
104104

105-
public override float[] Heuristic()
105+
public override void Heuristic(float[] actionsOut)
106106
{
107-
var action = new float[3];
108-
109-
action[0] = Input.GetAxis("Horizontal");
110-
action[1] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
111-
action[2] = Input.GetAxis("Vertical");
112-
return action;
107+
actionsOut[0] = Input.GetAxis("Horizontal");
108+
actionsOut[1] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
109+
actionsOut[2] = Input.GetAxis("Vertical");
113110
}
114111

115112
void Update()

Project/Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawlerDyn.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawlerSta.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/FoodCollector/Demos/ExpertFood.demo.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,27 +207,25 @@ public override void OnActionReceived(float[] vectorAction)
207207
MoveAgent(vectorAction);
208208
}
209209

210-
public override float[] Heuristic()
210+
public override void Heuristic(float[] actionsOut)
211211
{
212-
var action = new float[4];
213212
if (Input.GetKey(KeyCode.D))
214213
{
215-
action[2] = 2f;
214+
actionsOut[2] = 2f;
216215
}
217216
if (Input.GetKey(KeyCode.W))
218217
{
219-
action[0] = 1f;
218+
actionsOut[0] = 1f;
220219
}
221220
if (Input.GetKey(KeyCode.A))
222221
{
223-
action[2] = 1f;
222+
actionsOut[2] = 1f;
224223
}
225224
if (Input.GetKey(KeyCode.S))
226225
{
227-
action[0] = 2f;
226+
actionsOut[0] = 2f;
228227
}
229-
action[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
230-
return action;
228+
actionsOut[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
231229
}
232230

233231
public override void OnEpisodeBegin()

0 commit comments

Comments
 (0)