Atelier des rouesLaboratoire EN
Objets/Documentation

segments20.py

Je fournis le code pour reproduire ce calcul. segments20.py

Télécharger ↓
"""Shortest decodable segmentation of up to 64 words. Stdlib, 32 bits per word."""
from itertools import groupby,product
from math import comb
import json
from flux18 import rank,unrank


def options(words,i):
    weight=words[i].bit_count()
    width=(comb(32,weight)-1).bit_length()
    uniform=True
    for j in range(i+1,min(i+64,len(words))+1):
        uniform &= words[j-1].bit_count()==weight
        yield j,0,7+32*(j-i)
        if uniform:
            yield j,1,13+width*(j-i)

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.