using System.Collections.Generic; using UnityEngine; using MLAgents; namespace MLAgents { public class RandomDecision : MonoBehaviour, Decision { BrainParameters brainParameters; SpaceType actionSpaceType; public void Awake() { brainParameters = gameObject.GetComponent().brainParameters; actionSpaceType = brainParameters.vectorActionSpaceType; } public float[] Decide( List vectorObs, List visualObs, float reward, bool done, List memory) { if (actionSpaceType == SpaceType.continuous) { List act = new List(); for (int i = 0; i < brainParameters.vectorActionSize[0]; i++) { act.Add(2 * Random.value - 1); } return act.ToArray(); } else { float[] act = new float[brainParameters.vectorActionSize.Length]; for (int i = 0; i < brainParameters.vectorActionSize.Length; i++) { act[i]=Random.Range(0, brainParameters.vectorActionSize[i]); } return act; } } public List MakeMemory( List vectorObs, List visualObs, float reward, bool done, List memory) { return new List(); } } }