浏览代码

Divide team reward among living agents

/develop/cubewars/splashdamage
Ervin Teng 4 年前
当前提交
3679fb2a
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 9
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarArea.cs

9
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/CubeWarArea.cs


public void AgentDied()
{
bool smallAlive = false;
int numLiveAgents = 0;
numLiveAgents++;
}
}
bool largeAlive = false;

Debug.Log("Big Agent Wins");
foreach (var smallAgent in smallAgents)
{
smallAgent.SetReward(-1.0f);
if (smallAgent.gameObject.activeInHierarchy)
{
smallAgent.SetReward(-1.0f / numLiveAgents);
}
}
foreach (var largeAgent in largeAgents)
{

Debug.Log("Small Agents Win");
foreach (var smallAgent in smallAgents)
{
smallAgent.SetReward(1.0f);
smallAgent.SetReward(1.0f / numLiveAgents);
}
foreach (var largeAgent in largeAgents)
{

正在加载...
取消
保存