Mercurial > repo
changeset 10969:65ecc583baf2
<oerjan> sled bin/distort//2s:, math::;8cmw = len(int(2*s/N))-1
author | HackBot |
---|---|
date | Mon, 29 May 2017 08:07:47 +0000 |
parents | 75d67a002697 |
children | 422112e9865b |
files | bin/distort |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/distort Mon May 29 07:35:17 2017 +0000 +++ b/bin/distort Mon May 29 08:07:47 2017 +0000 @@ -1,11 +1,11 @@ #!/usr/bin/env python -import sys, math +import sys N = 350 name = sys.argv[1] if len(sys.argv) > 1 else "/dev/stdin" with open(name, "r") as f: data = ' \\ '.join(f.read().splitlines()) s = len(data) -mw = int(math.log10(2*s/N+1)) +mw = len(int(2*s/N))-1 mw += s > ((N-2)*9-18*mw+1)*((10**mw-1)/9)-mw p=0 i=1