Skip to main content
Commonmark migration
Source Link

##Python 3, 556 bytes

Python 3, 556 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:ord(c)%32*-~c.isupper(),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

##Python 3, 556 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:ord(c)%32*-~c.isupper(),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

Python 3, 556 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:ord(c)%32*-~c.isupper(),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

deleted 4 characters in body
Source Link
user45941
user45941

##Python 3, 560556 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:(ord(c)%32)*%32*-~(c~c.isupper()),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

##Python 3, 560 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:(ord(c)%32)*-~(c.isupper()),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

##Python 3, 556 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:ord(c)%32*-~c.isupper(),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

deleted 70 characters in body
Source Link
user45941
user45941

##Python 3, 586560 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s=strs,E,a,b,e=str.split
e=' '
a=lambda,enumerate,lambda c:(ord(c.lower()%32)*-96)*[1,2][c~(c.isupper()]
b=lambda),lambda w:sum(map(a,w)),' '
def j(w):
 z,y=map(len,s(w));h=w.count(e)
 return;return sum(i*a(x)for i,x in enumerateE(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in enumerateE(w)if i>=y+h)/b(w[-y:])
def f(w):
 x,v=j(w);m,n=map(b,s(w))
 return;return m*n/(x-v)**2
def q(w):
 x,v=s(w)
 return;return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,uu;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):
 x,y=p(w,t);u,v=s(w)
 return;return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it onlineTry it online (prints out *s instead of spaces so that it is more visible)

##Python 3, 586 bytes

s=str.split
e=' '
a=lambda c:(ord(c.lower())-96)*[1,2][c.isupper()]
b=lambda w:sum(map(a,w))
def j(w):
 z,y=map(len,s(w));h=w.count(e)
 return sum(i*a(x)for i,x in enumerate(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in enumerate(w)if i>=y+h)/b(w[-y:])
def f(w):
 x,v=j(w);m,n=map(b,s(w))
 return m*n/(x-v)**2
def q(w):
 x,v=s(w)
 return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):
 x,y=p(w,t);u,v=s(w)
 return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

##Python 3, 560 bytes

Thanks to FryAmTheEggman and Sherlock9 for some bytes

s,E,a,b,e=str.split,enumerate,lambda c:(ord(c)%32)*-~(c.isupper()),lambda w:sum(map(a,w)),' '
def j(w):z,y=map(len,s(w));h=w.count(e);return sum(i*a(x)for i,x in E(w)if i<z)/b(w[:z]),sum(i*a(x)for i,x in E(w)if i>=y+h)/b(w[-y:])
def f(w):x,v=j(w);m,n=map(b,s(w));return m*n/(x-v)**2
def q(w):x,v=s(w);return f(w)/b(x),-f(w)/b(v)
def p(w,t):
 x,v=q(w);c,d=x,v;m,n=map(b,s(w));r,u=j(w);g,h=r,u;
 for i in range(t):r+=x;u+=v;f=m*n/(r-u)**2;c,d=f/m,f/n;x+=c;v+=d
 return int(r-g),int(1+h-u)
def g(w,t):x,y=p(w,t);u,v=s(w);return e*x+u+e*(len(w)-len(u+v)-x-y)+v+e*y

g(w,t) takes the string (w) and the time (t), and returns the result. The other functions are helpers.

Try it online (prints out *s instead of spaces so that it is more visible)

Source Link
user45941
user45941
Loading