浏览代码

updated heuristics of cubewars

/asymm-envs
Andrew Cohen 5 年前
当前提交
843ddfc3
共有 2 个文件被更改,包括 17 次插入21 次删除
  1. 20
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  2. 18
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

20
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs


MoveAgent(vectorAction);
}
public override float[] Heuristic()
public override void Heuristic(float[] actionsOut)
var action = new float[5];
action[2] = 2f;
actionsOut[2] = 2f;
action[0] = 1f;
actionsOut[0] = 1f;
action[1] = 1f;
actionsOut[1] = 1f;
action[1] = 2f;
actionsOut[1] = 2f;
action[2] = 1f;
actionsOut[2] = 1f;
action[0] = 2f;
actionsOut[0] = 2f;
action[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
action[4] = Input.GetKey(KeyCode.O) ? 1.0f : 0.0f;
return action;
actionsOut[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
actionsOut[4] = Input.GetKey(KeyCode.O) ? 1.0f : 0.0f;
}
public override void OnEpisodeBegin()

18
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs


MoveAgent(vectorAction);
}
public override float[] Heuristic()
public override void Heuristic(float[] actionsOut)
var action = new float[4];
action[2] = 2f;
actionsOut[2] = 2f;
action[0] = 1f;
actionsOut[0] = 1f;
action[1] = 1f;
actionsOut[1] = 1f;
action[1] = 2f;
actionsOut[1] = 2f;
action[2] = 1f;
actionsOut[2] = 1f;
action[0] = 2f;
actionsOut[0] = 2f;
action[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
return action;
actionsOut[3] = Input.GetKey(KeyCode.Space) ? 1.0f : 0.0f;
}
public override void OnEpisodeBegin()

正在加载...
取消
保存