Skip to main content
Saved one byte by deleting an extraneous space
Source Link

Python 3, 2×497 + 619608 = 6206022×497+619608=620602 2×496+619608=620600

import operator as o l='' w='' d={} p={} s=0 def z(x,y): return sorted([(k,v) for k,v in x.items() if k.startswith(y)],key=o.itemgetter(1)) def f(c): global l,w,d,p,s r=' ' if c in 'in' \n': s+=1 if w in d:d[w]+=1 else:d[w]=1 if w: if l: t=l+' '+w if t in p:p[t]+=1 else:p[t]=1 n=z(p,w+' ') if n:g=n[-1];l=w;w='';r=g[0][len(l)+1] else:l=w;w='';r='t' else: w=w+c;m=z(p,w) if m: g=m[-1] if g[0]==w: if s>12:s=0;r='\n' else:r=g[0][len(w)] return r 

Edit: Saved one byte by deleting an extraneous space

Python 3, 2×497 + 619608 = 620602

import operator as o l='' w='' d={} p={} s=0 def z(x,y): return sorted([(k,v) for k,v in x.items() if k.startswith(y)],key=o.itemgetter(1)) def f(c): global l,w,d,p,s r=' ' if c in ' \n': s+=1 if w in d:d[w]+=1 else:d[w]=1 if w: if l: t=l+' '+w if t in p:p[t]+=1 else:p[t]=1 n=z(p,w+' ') if n:g=n[-1];l=w;w='';r=g[0][len(l)+1] else:l=w;w='';r='t' else: w=w+c;m=z(p,w) if m: g=m[-1] if g[0]==w: if s>12:s=0;r='\n' else:r=g[0][len(w)] return r 

Python 3, 2×497+619608=620602 2×496+619608=620600

import operator as o l='' w='' d={} p={} s=0 def z(x,y): return sorted([(k,v) for k,v in x.items() if k.startswith(y)],key=o.itemgetter(1)) def f(c): global l,w,d,p,s r=' ' if c in' \n': s+=1 if w in d:d[w]+=1 else:d[w]=1 if w: if l: t=l+' '+w if t in p:p[t]+=1 else:p[t]=1 n=z(p,w+' ') if n:g=n[-1];l=w;w='';r=g[0][len(l)+1] else:l=w;w='';r='t' else: w=w+c;m=z(p,w) if m: g=m[-1] if g[0]==w: if s>12:s=0;r='\n' else:r=g[0][len(w)] return r 

Edit: Saved one byte by deleting an extraneous space

added 67 characters in body
Source Link

That would have made The Wrath of Khan a lot more confusing. And "lonely" → "tingly" is a particularly satisfying substitution.

That would have made The Wrath of Khan a lot more confusing.

That would have made The Wrath of Khan a lot more confusing. And "lonely" → "tingly" is a particularly satisfying substitution.

Explain scoring
Source Link

This runs the program for the text of Moby Dick and outputs the "predicted" textto stdout, and abuses stderr to write the score. I'd recommend redirecting the output to a file.

This runs the program for the text of Moby Dick and outputs the "predicted" textto stdout, and abuses stderr to write the score. I'd recommend redirecting the output to a file.

Source Link
Loading