Generating a tree that may have branches that terminate [Python]
Question: I'm trying to create a script that will generate a tree in the following way:
if number is ever: split into 3 numbers: number // 2, number * 2, number + 15.
If number is odd: split into 2 numbers: number +1, number * 4. These branches
continue until a branch is either: greater than 100, equal to 6, a perfect
square (square root of number is an integer). I'm having a problem with having
either 2 or 3 branches for different conditions. Here is my code:

    
    
    import numpy as np
    
    class Node(object):
        def __init__(self,number,parent):
            self._parent = parent
            self._number = number
            self._satisfied = number > 100 or number == 6 or np.sqrt(number) % 1 == 0
            self._branch1 = None
            self._branch2 = None
            self._branch3 = None
            self._depth = parent.depth + 1 if parent != None else 1
    
        @property
        def parent(self):
            return self._parent
    
        @property
        def number(self):
            return self._number
    
        @property
        def satisfied(self):
            return self._satisfied
    
        @property
        def depth(self):
            return self._depth
    
        @property
        def branch1(self):
            return self._branch1
    
        @branch1.setter
        def branch1(self,value):
            self._branch1 = value
    
        @property
        def branch2(self):
            return self._branch2
    
        @branch2.setter
        def branch2(self,value):
            self._branch2 = value
    
        @property
        def branch3(self):
            return self._branch3
    
        @branch3.setter
        def branch3(self,value):
            self._branch3 = value
    
    def print_all_chains(node,chain=[]):
        if node.branch1 is None:
            chain.append(node.number)
            print '{0}: {1}'.format(node.satisfied, chain)
        else:
            print_all_chains(node.branch1, chain[:] + [node.number])
            print_all_chains(node.branch2, chain[:] + [node.number])
            print_all_chains(node.branch3, chain[:] + [node.number])
    
    def make_daughters(number):
        if number % 2 == 0: #even
            daughters = [number // 2, number * 2, number + 15]
        else:
            daughters = [number + 1, number * 4, None]
        return daughters
    
    def build_tree(node, maxDepth):
        if not node.satisfied and node.depth<maxDepth:
            daughters = make_daughters(node.number)
            node.branch1 = Node(daughters[0], node)
            build_tree(node.branch1,maxDepth)
            node.branch2 = Node(daughters[1], node)
            build_tree(node.branch2,maxDepth)
            node.branch3 = Node(daughters[2], node)
            build_tree(node.branch3, maxDepth)
    
    def find_decay(number):
        root = Node(number,None)
        build_tree(root,maxDepth=3)
        print_all_chains(root)
    
    if __name__ == '__main__':
        find_decay(int(raw_input('Number: ')))
    


Answer: Why not use a list to keep the branch information? Then it can be rewritten
into this way without adding a **None** type element in the two branch
situation.

    
    
    daughters = make_daughters(node.number)
    node.branch = [Node(d, node) for d in daughters]
    

Without worries about **None** type elements

