protected async override Task ExecuteAsync() { Console.WriteLine("Starting Herd"); var herd = new Shepherd(Root.Connection, "", worldKey: World); var configMonster = new ConfigMonster(); configMonster.Configure(File); var baseMonsterType = Type.GetType(configMonster.RobotType); var parent = Activator.CreateInstance(baseMonsterType, herd) as ConfigMonster; if (File != null) { parent.Configure(File); } await herd.StartRobot(parent); await parent.SpawnAsync(); Console.ReadLine(); }
public ShepherdViewModel() { HerdAgentList.Clear(); m_shepherd = new Shepherd(); m_shepherd.SetOnHerdAgentDiscoveryFunc(OnHerdAgetDiscovery); m_shepherd.CallHerd(); }
public ExperimentBatch(string name, List <MonitoredExperimentViewModel> experiments, HerdAgentViewModel herdAgent , PlotViewModel evaluationPlot, CancellationToken cancelToken, Logger.LogFunction logFunction) { m_name = name; m_monitoredExperiments = experiments; m_herdAgent = herdAgent; m_logFunction = logFunction; m_shepherd = new Shepherd(); m_shepherd.setLogMessageHandler(logFunction); m_cancelToken = cancelToken; m_evaluationPlot = evaluationPlot; m_experimentSeriesId = new Dictionary <string, int>(); }
public ShepherdViewModel() { m_shepherd = new Shepherd(); m_shepherd.setNotifyAgentListChangedFunc(notifyHerdAgentChanged); m_timer = new System.Timers.Timer(m_updateTimeSeconds * 1000); m_shepherd.sendBroadcastHerdAgentQuery(); m_shepherd.beginListeningHerdAgentQueryResponses(); m_timer.AutoReset = true; m_timer.Elapsed += new System.Timers.ElapsedEventHandler(resendBroadcast); m_timer.Start(); }
protected async override Task ExecuteAsync() { Console.WriteLine("Starting Herd"); var shepard = new Shepherd(Root.Connection, "", worldKey: World); var sheparedConfiguration = System.IO.File.ReadAllText(File); JsonConvert.PopulateObject(sheparedConfiguration, shepard); await shepard.RunAsync(); Console.WriteLine("they dead, man."); }
public static void Run() { Console.WriteLine("Scanning herd agents:\n"); Shepherd shepherd = new Shepherd(); shepherd.CallHerd(); Thread.Sleep(2000); List <HerdAgentInfo> herdAgents = new List <HerdAgentInfo>(); shepherd.GetHerdAgentList(ref herdAgents); for (int i = 0; i < herdAgents.Count; i++) { Console.WriteLine("#{0}: IP={1} Num.Processors={2} Architecture={3}", i, herdAgents[i].IpAddressString, herdAgents[i].NumProcessors, herdAgents[i].ProcessorArchitecture); } }
public SpawnBeast(Shepherd tender) : base(tender) { }
public SpawnChild(Shepherd tender) : base(tender) { this.Sprite = Sprites.ship_gray.ToString(); }
public ConfigMonster(Shepherd tender = null) { Tender = tender; }
// Start is called before the first frame update void Awake() { movable = GetComponent <Movable>(); animator = GetComponent <Animator>(); instance = this; }
public Territory(Shepherd tender) : base(tender) { SwapTeams(); }
public static void Run(string batchFilename, bool onlyUnfinished) { if (batchFilename == null) { Console.WriteLine("Error. Missing argument: -batch"); return; } if (!File.Exists(batchFilename)) { Console.WriteLine("Error. File doesn't exist: " + batchFilename); return; } //All the experimental units or only unfinished??? LoadOptions loadOptions = new LoadOptions(); if (onlyUnfinished) { loadOptions.Selection = LoadOptions.ExpUnitSelection.OnlyUnfinished; } else { loadOptions.Selection = LoadOptions.ExpUnitSelection.All; } Console.WriteLine("Running batch file: " + batchFilename); g_writer = System.IO.File.CreateText("log.txt"); ExperimentBatch batch = new ExperimentBatch(); batch.Load(batchFilename, loadOptions); NumUnfinishedExpUnits = batch.CountExperimentalUnits(); NumTotalExpUnits = NumUnfinishedExpUnits; if (NumUnfinishedExpUnits == 0) { Console.WriteLine("Finished: No experimental unit to be run"); return; } else { Console.SetCursorPosition(0, experimentStatsLine); Console.WriteLine("Experimental units:"); UpdateExperimentStats(); } Console.SetCursorPosition(0, herdAgentsLine); Console.Write("Herd agents:"); Shepherd shepherd = new Shepherd(); shepherd.CallHerd(); Thread.Sleep(2000); List <HerdAgentInfo> herdAgents = new List <HerdAgentInfo>(); shepherd.GetHerdAgentList(ref herdAgents); Console.SetCursorPosition(herdAgentsRow, herdAgentsLine); Console.WriteLine("{0} available", herdAgents.Count); if (herdAgents.Count == 0) { Console.WriteLine("Error: no herd agents found to run the experiment batch"); } Console.Write("Total progress: "); List <ExperimentalUnit> experiments = new List <ExperimentalUnit>(); foreach (Experiment exp in batch.Experiments) { experiments.AddRange(exp.ExperimentalUnits); } CancellationTokenSource cancelSource = new CancellationTokenSource(); Monitoring.MsgDispatcher dispatcher = new Monitoring.MsgDispatcher(OnJobAssigned, OnJobFinished , DispatchOnAllStatesChanged, DispatchOnStateChanged , DispatchOnMessageReceived, DispatchOnExperimentalUnitLaunched , Log, cancelSource.Token); int numExecutedExperimentalUnits = JobDispatcher.RunExperimentsAsync(experiments, herdAgents, dispatcher, cancelSource).Result; Console.SetCursorPosition(0, resultLine); Console.WriteLine("Badger finished: " + numExecutedExperimentalUnits + " experimental units were succesfully run"); g_writer.Close(); }