Atelier des rouesLaboratoire EN
Objets/Documentation

trois22.py

Trois changements de décalage · trois22.py

Télécharger ↓
"""Adversarial shifts on a 24-tick schedule, up to three switches."""
from itertools import combinations,accumulate
import json
from decalages19 import LEFT

DELAY=(-1,0,1)


def solve(phase,h):
    def hit(t,e):return int(t in LEFT and (t-phase-e)%6 in {x%6 for x in (0,1,4,8,9)})
    sums={e:list(accumulate((hit(t,e) for t in range(24)),initial=0)) for e in DELAY}
    seg={(a,b):min((v[b]-v[a],e) for e,v in sums.items()) for a in range(24) for b in range(a+1,25)}
    ans=[]
    for k in range(4):
        best=(25,[],[])
        for cc in combinations(range(1,24),k):

Lire dans son contexte

Commentaires

Les commentaires en français et en anglais sont réunis ici.

La discussion reste consultable. J’ouvrirai les participations dès que la protection antispam sera configurée.