예제 #1
0
    void Start()
    {
        _spacedeath        = false;
        dead               = false;
        initialDrag        = rb.drag;
        lastInstructionPos = transform.position;

        instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>();
        instructionHandler.AddNextPlayerInstruction(transform.position);
    }
예제 #2
0
 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;
 }
예제 #3
0
            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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
 // Use this for initialization
 void Awake()
 {
     instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>();
     beacon             = GetComponentInParent <Beacon>();
 }
예제 #8
0
 public void SetUp()
 {
     _instructionHandler = new InstructionHandler();
 }
예제 #9
0
 // Use this for initialization
 void Awake()
 {
     instructionHandler = GameObject.Find("InstructionHandler").GetComponent <InstructionHandler>();
     exit = GetComponentInParent <Exit>();
 }
예제 #10
0
 public InstructionTemplate(InstructionType type, string format, InstructionHandler handler)
 {
     Type    = type;
     Format  = format;
     Handler = handler;
 }