generate-alt-random: DECGRI: don’t emit zero-length repeat sequences

This commit is contained in:
Daniel Eklöf 2021-03-09 12:01:18 +01:00
parent 8ba455f70e
commit f3bc5a95b5
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -208,9 +208,9 @@ def main():
else: else:
pix_left = six_width pix_left = six_width
while pix_left > 0: while pix_left > 0:
pix_count = random.randrange(pix_left + 1) repeat_count = random.randrange(1, pix_left + 1)
out.write(f'!{pix_count}{random.choice(sixels)}') out.write(f'!{repeat_count}{random.choice(sixels)}')
pix_left -= pix_count pix_left -= repeat_count
# Next line # Next line
if band + 1 < band_count: if band + 1 < band_count: