Atelier des rouesLab FR
Objects/Documentation

branchements13.py

I provide the material for check AT.COD5.

Download ↓
"""Rank entire sparse transition types; brute-force generator uses only interior symbol counts."""
from collections import Counter
from adresses12 import Index
import json
def brute(w):
    need=Counter(zip(w,w[1:]));left=Counter(w[1:-1]);out=[]
    def visit(prefix):
        if len(prefix)==len(w)-1:
            x=(*prefix,w[-1])
            if Counter(zip(x,x[1:]))==need:out.append(x)
            return
        for a in sorted(left):
            if left[a]:
                left[a]-=1;visit((*prefix,a));left[a]+=1
    visit((w[0],));return out

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.