public bool validate(IOrganismo memoryContainer) { if (memoryContainer == null) { memoryContainer = this; } int memorySize2 = getMemorySize(); memorySize2 = CONSTS.validateMemorySize(parent(), memorySize2); if (memorySize2 == 0) { parent().criticalError(); return false; } bool hasMal = false; bool hasDivide = false; bool hasRequireTemplate = false; int sp = sp(); int i = 0; int step = 1; while (i < memorySize2) { Instruction inst = memoryContainer.getInstructionAt(sp + i); if (inst != null) { step = inst.getStep(); if ((inst instanceof MalInstruction) || (inst instanceof ConnectInstruction)) { hasMal = true; } if ((inst instanceof DivideInstruction) || (inst instanceof DisconnectInstruction)) { hasDivide = true; } if (inst.requiresTemplate()) { hasRequireTemplate = true; } } else { step = 1; } i += step; } if (!hasMal || !hasDivide) { return false; } else { addFitness(); return true; } }