public string Interpret(EnqueuedInstruction in_instruction) { instruction = in_instruction; MemoryBlock memoryBlock = instruction.GetNode().GetMemory(instruction.GetSource()); double in_command = memoryBlock.GetCell(0).value; // Interpret command // XXX: Comparing using values instead of strings to guarantee interpretation // Will require a better setup Command cmd = null; //Debug.Log("IN: " + in_command); foreach (string commandString in commands.Keys) { double commandValue; AlphaNumeral.StringToDbl(commandString, out commandValue); //Debug.Log("CMD: " + commandString); //Debug.Log("VAL: " + commandValue); if (in_command == commandValue) { cmd = commands[commandString]; break; } } if (cmd == null) { return("Commands '" + memoryBlock.GetCell(0).content + "' not found"); } // Gather 'input' string from MemoryBlock contents string input = ""; for (int i = 0; i < GameManager.gameOptions.memoryCellCount; i++) { input += memoryBlock.GetCell(i).content + " "; } bool success; string output = cmd(input, out success); instruction = null; return(output); }