Esempio n. 1
0
 public static Color GetDataColor(IRunningInstruction ri)
 {
     if (ri.Operation == Operation.DAT && (ri.ValueA != 0 || ri.ValueB != 0))
     {
         return Color.White;
     }
     else
     {
         return GetInstructionColor(ri);
     }
 }
Esempio n. 2
0
 private void ResetCache()
 {
     tasksCopyLoaded = false;
     lastInstruction = null;
     tasksCopy       = null;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 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;
     }
 }
Esempio n. 6
0
        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;
        }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 public static Color GetInstructionColor(IRunningInstruction ri)
 {
     return operationColors[(int)ri.Operation];
 }
Esempio n. 10
0
 public static void GetFade(IRunningInstruction ri, CoreEventRecord evt, out Color evnt, out Color owner)
 {
     evnt = GetEventColor(evt.Event);
     owner = GetWarriorColor(ri.OriginalOwner);
 }
Esempio n. 11
0
 private void ResetCache()
 {
     tasksCopyLoaded = false;
     lastInstruction = null;
     tasksCopy = null;
 }
Esempio n. 12
0
 protected virtual void InitializeCycle(int Ip)
 {
     ResetCache();
     int nextInstructionAddress = NextInstructionAddress;
     if (nextInstructionAddress!=-1)
     {
         lastInstruction = new EngineInstruction(core[nextInstructionAddress], nextInstructionAddress);
     }
 }