Atelier des rouesLab FR
Objects/Documentation

deux27.py

How many early constructions for six outputs? · deux27.py

Download ↓
"""Compare budgets of zero, one, two and unlimited early constructions on six outputs."""
from collections import deque,Counter
from itertools import product
import json
from quatre24 import oracle

def limited(word,motif,cap):
    parents=[0,motif]+[{'A':1,'B':2,'X':3}[c] for c in word]
    order=tuple(range(2,len(parents)));start=(0,0,0)
    q=deque([(start,0)]);seen={start}
    while q:
        (mask,i,spent),dist=q.popleft()
        if i==len(order):return dist
        for line,ps in enumerate(parents):
            if mask>>line&1 or mask&ps!=ps or line in order[:i]:continue
            early=line in order[i+1:]

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.