Soloing
ci / checks (push) Successful in 1h9m55s

This commit is contained in:
khodowany
2026-10-01 08:35:12 -05:00
parent eae432aa83
commit 75655786e9
16 changed files with 1015 additions and 161 deletions
+8 -2
View File
@@ -26,8 +26,14 @@ def place(notes: tuple[generator.solo.types.Note, ...], tempo: fractions.Fractio
following = []
for position in positions(note.pitch.number()):
current = dataclasses.replace(note, position=position)
candidates = [(cost + travel(path[-1] if path else previous, current, tempo), (*path, current)) for cost, path in states]
following.append(min(candidates, key=lambda item: (item[0], tuple(n.position for n in item[1]))))
candidates = []
for cost, path in states:
prior = path[-1] if path else previous
if note.continuation and (prior is None or prior.pitch != note.pitch or prior.position != position or prior.end != note.start):
continue
candidates.append((cost + (0 if note.continuation else travel(prior, current, tempo)), (*path, current)))
if candidates:
following.append(min(candidates, key=lambda item: (item[0], tuple(n.position for n in item[1]))))
if not following:
return None
states = following