public override InstructionModel Create(InstructionCreationContext context)
 {
     return(new InstructionModel()
     {
         Type = Type,
         Data = context.Random.Next(0, context.MemorySize)
     });
 }
Example #2
0
        private InstructionModel CreateInstruction()
        {
            //Get an instruction type
            InstructionType instructionType = (InstructionType)_random.Next(0, (int)InstructionType.ConditionalSkip + 1);

            //Get the instruction implementation
            InstructionBase instruction = _instructionFactory[instructionType];

            //Create the context
            var context = new InstructionCreationContext(_random, _memorySize, _numberOfInstructions);

            //finally, create the damn instruction
            return(instruction.Create(context));
        }
 public abstract InstructionModel Create(InstructionCreationContext context);