Atelier des rouesLab FR
Objects/Documentation

longueurs28.py

Effect of one more switch over five turns · longueurs28.py

Download ↓
"""Three turns, dwell two. Compare transfer with explicitly enumerated switch schedules."""
from collections import Counter,defaultdict
from functools import lru_cache
from itertools import combinations,product
import json



@lru_cache(None)
def runs(turns,start,a,b,c,k):
    ordered=sorted((6*n+(start+j)%6,j) for j,group in enumerate((a,b,c)) for n in group)
    end=changes=0
    for (t,i),(s,j) in zip(ordered,ordered[1:]):
        if i!=j:
            changes+=1;end=max(end+2,t+1)
            if changes>k or end>s:return False

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.