ultimate/node.py

18 lines
415 B
Python
Raw Permalink Normal View History

2022-07-09 18:45:25 -05:00
# node implementation
class Node:
def __init__(self):
self.children = []
self.score = None
2022-07-11 19:27:49 -05:00
self.inner = None
2022-07-09 18:45:25 -05:00
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