Atelier des rouesLab FR
Objects/Documentation

interface31.py

Retaining one premise at the cut · interface31.py

Download ↓
"""Compose optimal block costs through one surviving premise; verify by joint BFS."""
from collections import deque
from functools import lru_cache
from pathlib import Path
from itertools import product
from barriere30 import bfs
import json
@lru_cache(None)
def costs(word,motif,cap,start):
    parents=[0,motif]+[{'A':1,'B':2,'X':3}[c] for c in word]
    n=len(word);q=deque([(start,0,0,0)]);seen=set();ends={}
    while q:
        live,i,spent,dist=q.popleft()
        if (live,i,spent) in seen:continue
        seen.add((live,i,spent))
        if i==n:

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.