Created
November 8, 2017 22:43
-
-
Save elbruno/3bfc8383767345aa18ea7a339c0dd442 to your computer and use it in GitHub Desktop.
malmobasicprogram01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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