コード例 #1
0
        static void Main(string[] args)
        {
            var brainmessProcessor = new BrainmessInterpreter();
            brainmessProcessor.Program =
                new BrainmessProgram
                    {
                        Instructions =
                            "++++++++[>+++++++++<-]>.<+++++[>++++++<-]>-.+++++++..+++.<++++++++[>>++++<<-]>>.<<++++[>------<-]>.<++++[>++++++<-]>.+++.------.--------.>+."
                    };

            //brainmessProcessor.Program.Instructions = "+++>+++..[.-]..";
            //string program = "<<<<++++++++[>+++++++++<-]>.";
            brainmessProcessor.Execute();
            Console.ReadLine();

        }
コード例 #2
0
 public void TestExecute()
 {
     var brainmessProcessor = new BrainmessInterpreter
     {
         Program = new BrainmessProgram
         {
             Instructions = "><+-[]"
         }
     };
     brainmessProcessor.Execute();
     Assert.AreEqual(0, brainmessProcessor.TapeMemory.CurrentCellValue);
 }
コード例 #3
0
 public void TestExecuteCurrentInstruction()
 {
     var brainmessProcessor = new BrainmessInterpreter
     {
         Program = new BrainmessProgram
         {
             Instructions = ">"
         }
     };
     brainmessProcessor.Execute();
     Assert.AreEqual(1, brainmessProcessor.TapeMemory.CurrentPointer);
 }