Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void addMainFunction(StringBuilder sb) throws IllegalAccessException
        private void addMainFunction(StringBuilder sb)
        {
            sb.Append("MainFunction:").Append("\n");
            sb.Append("VariableCount: ").Append(mainFunction.VariablesCount).Append("\n");
            for (int i = 0; i < mainFunction.Size; i++)
            {
                Instruction instruction = mainFunction.getInstruction(i);
                sb.Append(instruction.instructionString()).Append("\n");
            }
        }
 private void copyBlock(InstructionList destination, InstructionList source, int start, int stop)
 {
     Debug.Assert(start <= stop, "start > stop " + string.Format("{0:D} {1:D}", start, stop));
     for (int i = start; i <= stop; i++)
     {
         Instruction instruction = source.getInstruction(i).copy();
         if (instruction is TerminateInstructionList)
         {
             break;
         }
         addInstructionToInstructionList(instruction, destination);
     }
 }
Ejemplo n.º 3
0
        private void executeInstructionList(InstructionList list)
        {
            list.zeroOutVariables();
            terminateInstructionList = false;
            int instructionPointer = 0;

            instructionList = list;
            do
            {
                Instruction instruction = list.getInstruction(instructionPointer++);
                instruction.executeOn(this);
                totalInstructionExecuted++;
                if (totalInstructionExecuted > robotInstructionLimit)
                {
                    break;
                }
                instructionPointer       = Math.Abs((instructionPointer + changeInstructionPointer) % instructionList.Size);
                changeInstructionPointer = 0;
            } while (!terminateInstructionList && !finished);
        }