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