void Start() { _spacedeath = false; dead = false; initialDrag = rb.drag; lastInstructionPos = transform.position; instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>(); instructionHandler.AddNextPlayerInstruction(transform.position); }
public Cpu(Bus bus) { Hz = 2000000; this.Bus = bus; Reg = new Register(); Flags = new StatusRegister(); Alu = new Alu(); Decoder = new InstructionHandler(this); Bus.InterruptEvent += Bus_InterruptEvent; ThrottleFrequency = 100; }
public new static InstructionHandler CreateInstructionHandler(Instruction instruction) { InstructionHandler instructionHandler = instruction.Operation switch { Operation.BitMask => new BitMaskInstructionHandler(instruction), Operation.Memory => new MemoryInstructionHandlerPart2(instruction), _ => new InvalidInstructionHandler(instruction), }; return(instructionHandler); }
public void Translate() { Range r1 = new Range(5, 4, "3"); Range r2 = new Range(3, 2, "#1"); Range r3 = new Range(1, 0, "#2"); ranges = new Range[] { r1, r2, r3 }; ih = new InstructionHandler("test", "test (?<1>[0-9]+) (?<2>[0-9]+)", ranges); string line = "test 2 3"; Assert.AreEqual(0b111011, ih.Translate(line)); }
public IActionResult Index() { RoverViewModel rvm = JsonConvert.DeserializeObject <RoverViewModel>(TempData["RoverData"].ToString()); TempData["RoverData"] = JsonConvert.SerializeObject(rvm); InstructionHandler instructionHandler = new InstructionHandler(); ResultsViewModel results = new ResultsViewModel() { Grid = rvm.Grid, Rovers = rvm.Rovers, Results = instructionHandler.GetUpdatedPosition(rvm) }; return(View(results)); }
private void RunButton_Click(object sender, RoutedEventArgs eventArgs) { if (!Busy && Instructions.Count > 0) { foreach (var instruction in Instructions) { instruction.BackgroundColor = Brushes.Black; } Busy = true; try { var ins = "(run '(0 8 0 0) (list " + string.Join(" ", Instructions) + "))"; Task.Run(() => { InstructionHandler.Run(ins); Busy = false; Instructions.Last().BackgroundColor = Brushes.Green; var player = new SoundPlayer(@"Sounds/work-complete.wav"); player.Play(); MessageBox.Show("Okey dokey", "Job's done!", MessageBoxButton.OK, MessageBoxImage.Information); }); } catch (Exception exception) { ErrorConsole.Text = exception.Message; } } else { var player = new SoundPlayer(@"Sounds/annoyed5.wav"); player.Play(); MessageBox.Show("You can only run one command at a time", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
// Use this for initialization void Awake() { instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>(); beacon = GetComponentInParent <Beacon>(); }
public void SetUp() { _instructionHandler = new InstructionHandler(); }
// Use this for initialization void Awake() { instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>(); exit = GetComponentInParent <Exit>(); }
public InstructionTemplate(InstructionType type, string format, InstructionHandler handler) { Type = type; Format = format; Handler = handler; }