diff --git a/node.py b/node.py new file mode 100644 index 0000000..72626b0 --- /dev/null +++ b/node.py @@ -0,0 +1,18 @@ +# node implementation + +class Node: + def __init__(self): + self.children = [] + self.score = None + def calculate(self): + if self.children == []: + return self.score + total = 0 + items = 0 + for i in self.children: + score = i.calculate() + if score != None: + items += 1 + total += score + +