Objects/Documentation
sept28.py
Preparing one of seven outputs early · sept28.py
Download ↓"""Exact costs for seven ordered outputs on two slots, with replayable first separation."""
from itertools import product
from collections import Counter,deque
from deux27 import limited
from quatre24 import oracle
import json
def path(word,motif,budget):
parents=[0,motif]+[{'A':1,'B':2,'X':3}[c] for c in word]
start=(0,2,0);parent={start:None};queue=deque([start])
while queue:
s=queue.popleft();mask,i,spent=s
if i==len(parents):
steps=[]
while parent[s]:
old,line,keep=parent[s];steps.append([line,keep,*s]);s=old
return list(reversed(steps))