def find_path(data, instructions, num_outputs):
queue = [QueueEntry(data, [])]
while queue:
queue_entry = queue.pop()
if len(queue_entry.data) == num_outputs and all(c == queue_entry.data[0] for c in queue_entry.data):
return queue_entry.data
for instruction in instructions:
if instruction not in queue_entry.used: # need to replace this line with something
queue.append(QueueEntry(
[*instruction(*queue_entry.data)],
queue_entry.used + [instruction]
)
)
signals = [Signal({'A': 0.5, 'B': 0.5}), Signal({'B': 1})]
instructions = [Splitter.split,]
print(find_path(signals, instructions, 2))
so this works but only for len(signals) == 2 because of Splitter.split only able to receive 1-2 inputs
need help making this work for any len(signals) and instructions being able to be used more than once without it spiraling into an infinite loop 