예제 #1
0
        public static PurringMachine GetDefaultMachine()
        {
            PurringMachine m        = new PurringMachine();
            const bool     fromLeft = false;

            m.SetInstructions(GetIncrementBinaryValueInstructionSet(), fromLeft);
            m.SetTapeData("1111");
            m.Reset();
            return(m);
        }
예제 #2
0
        public ActionResult Index()
        {
            LoadMachineState();
            if (Machine == null)
            {
                Machine = Machine.GetDefaultMachine();
                SaveMachineState();
            }

            ViewData["initTapeData"] = new string(Machine.Tape.ToArray());

            return(View());
        }
예제 #3
0
 private void SetMachine(Machine machine)
 {
     Session["Machine"] = machine;
 }
예제 #4
0
 private void LoadMachineState()
 {
     this.Machine = GetMachine();
 }