Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
malmobasicprogram01
using System;
using System.Threading;
using Microsoft.Research.Malmo;
namespace Malmo03
{
class Program
{
private static AgentHost _agentHost;
public static void Main()
{
_agentHost = new AgentHost();
_agentHost.parse(new StringVector(Environment.GetCommandLineArgs()));
var mission = new MissionSpec();
mission.timeLimitInSeconds(15);
mission.requestVideo(640, 480);
mission.rewardForReachingPosition(19.5f, 0.0f, 19.5f, 100.0f, 1.1f);
var recordedFileName = $"./mission_data{DateTime.Now:hh mm ss}.tgz";
var missionRecord = new MissionRecordSpec(recordedFileName);
missionRecord.recordCommands();
missionRecord.recordMP4(20, 400000);
missionRecord.recordRewards();
missionRecord.recordObservations();
_agentHost.startMission(mission, missionRecord);
WorldState worldState;
Console.WriteLine("Waiting for the mission to start");
do
{
Console.Write(".");
Thread.Sleep(100);
worldState = _agentHost.getWorldState();
}
while (!worldState.has_mission_begun);
Console.WriteLine("Mission in progress !");
Console.WriteLine();
do
{
Console.Write("-");
Thread.Sleep(100);
} while (worldState.is_mission_running);
Console.WriteLine("Mission has stopped.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment