class brain: def __init__(self): self.inputs = [] self.hidden = [] self.outputs = [] class neuron: def __init__(self, threshhold ): self.output = None #the node to output to self.threshhold = threshhold #threshhold self.w = [] #inputs self.active = 0 #0 means not active def setOutput(self, neuron, weight): self.output = neuron self.output.addInput(self, weight) def addInput(self, neuron, weight) self.w.append((neuron,weight)) def processInputs(self): sum = 0 for n,w in self.w: sum += (n.active * w) if sum => self.threshhold: self.active = 1 else: self.active = 0