public static Color GetDataColor(IRunningInstruction ri) { if (ri.Operation == Operation.DAT && (ri.ValueA != 0 || ri.ValueB != 0)) { return Color.White; } else { return GetInstructionColor(ri); } }
private void ResetCache() { tasksCopyLoaded = false; lastInstruction = null; tasksCopy = null; }
private static void PaintNormal(IMemoryPainter painter, IRunningInstruction ri) { Color data; Color instruction; Color owner; ColorManager.GetNormal(ri, out data, out instruction, out owner); painter.DrawBig(owner); painter.DrawSmall(instruction); painter.DrawData(data); }
private static void PaintFade(IMemoryPainter painter, IRunningInstruction ri, CoreEventRecord evt) { Color evnt; Color owner; ColorManager.GetFade(ri, evt, out evnt, out owner); painter.DrawSmall(evnt); painter.DrawBig(owner); painter.DrawData(evnt); }
public static void PaintCell(IMemoryPainter painter, CoreEventRecord evnt, IRunningInstruction ri, bool paintAll) { switch (evnt.Level) { case CoreEventsLevel.Flash: PaintFlash(painter,evnt); break; case CoreEventsLevel.Fade: PaintFade(painter, ri, evnt); break; case CoreEventsLevel.Clean: PaintNormal(painter, ri); break; case CoreEventsLevel.None: if (paintAll) { PaintNormal(painter, ri); } break; } }
public StepResult NextStep() { if (lastInstructionWatchMode) { //copy instruction lastInstruction = NextInstruction; } lastStepResult = (StepResult)pMarsDll.pMarsStepMatch(); dllCoreLoaded = false; dllTasksLoaded = false; dllWarriorsLoaded = false; cycle++; if (lastStepResult > StepResult.Continue) { if (lastStepResult != StepResult.Finished) { cycle = 0; } else { pMarsDll.pMarsResultsMatch(); dllWarriorsLoaded = false; CopyWarriors(); results.score = new int[rules.WarriorsCount]; for (int w = 0; w < rules.WarriorsCount; w++) { results.score[w] = warriorsDllCopy[w].totalScore; } } } return lastStepResult; }
public MatchResult EndMatch(ISimpleOutput console) { pMarsDll.pMarsEndMatch(); dllCore = IntPtr.Zero; dllCoreSize = 0; dllCyclesLeft = IntPtr.Zero; dllRound = IntPtr.Zero; dllWarriors = IntPtr.Zero; dllWarriorsCout = 0; dllWarrirorsLeft = IntPtr.Zero; dllNextWarrior = IntPtr.Zero; dllTasksStart = IntPtr.Zero; dllTasksEnd = IntPtr.Zero; dllPSpaces = IntPtr.Zero; dllCoreLoaded = false; dllTasksLoaded = false; dllWarriorsLoaded = false; dllDataLinked = false; lastInstruction = null; try { File.Delete(errFile); } catch (Exception) { // swallow } //results.ComputePoints(); //results.Dump(output, Project); return results; }
public static void GetNormal(IRunningInstruction ri, out Color data, out Color instruction, out Color owner) { instruction = GetInstructionColor(ri); data = GetDataColor(ri); owner = GetWarriorColor(ri.OriginalOwner); }
public static Color GetInstructionColor(IRunningInstruction ri) { return operationColors[(int)ri.Operation]; }
public static void GetFade(IRunningInstruction ri, CoreEventRecord evt, out Color evnt, out Color owner) { evnt = GetEventColor(evt.Event); owner = GetWarriorColor(ri.OriginalOwner); }
protected virtual void InitializeCycle(int Ip) { ResetCache(); int nextInstructionAddress = NextInstructionAddress; if (nextInstructionAddress!=-1) { lastInstruction = new EngineInstruction(core[nextInstructionAddress], nextInstructionAddress); } }