//---------------------------------------------------------------------------------------------------------------------- void CreateResetNetworkEvent() { // Always check that there are listeners for the event if (null != ResetNetworkEvent) { // Creates here the arguments for the event var myArguments = new ObservationEventArgs(); // Catches exceptions thrown by event listeners. This prevents // listener exceptions from terminating the algorithm thread. try { ResetNetworkEvent(null, myArguments); } catch (Exception ex) { //__log.Error("ResetNetworkEvent listener threw exception", ex); System.Diagnostics.Debug.WriteLine("ResetNetworkEvent listener threw exception" + ex); } } }
void OnResetEvent(object sender, ObservationEventArgs eventArguments) { System.Diagnostics.Debug.WriteLine("\n Resetting the network for a clean start"); brain.ResetState(); System.Diagnostics.Debug.WriteLine("Reset done"); }
/// <summary> /// Program Malmo will execute Minecraft. At some points it will create /// an update event, so which this controller is subscribed. This event /// passes the observations as parameters (observations are the state /// of the Minecraft simulation, such as position or the type of blocks /// in the surroundings). /// This class, the brain, will take these observations and translate /// them into commands for the Minecraft character (using a neural network). /// This will be done every time the event is called. /// </summary> /// <param name="sender">Sender.</param> /// <param name="eventArguments">Event arguments.</param> void WhenObservationsEvent(object sender, ObservationEventArgs eventArguments) { ObservationsToCommands(eventArguments.observations); }
void OnResetEvent(object sender, ObservationEventArgs eventArguments) { brain.ResetState(); }
/// <summary> /// Program Malmo will execute Minecraft. At some points it will create /// an update event, so which this controller is subscribed. This event /// passes the observations as parameters (observations are the state /// of the Minecraft simulation, such as position or the type of blocks /// in the surroundings). /// This class, the brain, will take these observations and translate /// them into commands for the Minecraft character (using a neural network). /// This will be done every time the event is called. /// </summary> /// <param name="sender">Sender.</param> /// <param name="eventArguments">Event arguments.</param> void WhenObservationsEvent(object sender, ObservationEventArgs eventArguments) { // This parameter is passed down several levels: consider making a // class global variable. ObservationsToCommands(eventArguments.observations); }