# Search Results

Results tagged with Search options answers only user 34531
5 results

For challenges pertaining to problems in the field of Physics.

Haskell, 69 bytes r=replicate f n=[0..n]>>= \a->r a '\n'++r(n-a)' '++'O':r(2*a)' '++"O" Usage example: f 3 -> " OO\n O O\n\n O O\n\n\nO O". Try it online!.
answered Mar 3 '17 by nimi
Haskell, 145 bytes import Control.Concurrent a!b=[a..b]>>"\n" f h=mapM(\k->putStr("\27[2J"++1!k++'O':k!h++"-")>>threadDelay(round$4472135*(sqrt(k+1)-sqrt k)))[1..h] Needs to be run in an ANSI term … answered Feb 9 by nimi Haskell, 116 96 82 76 bytes f x=signum$sum$zipWith(*)[-length(fst$span(<'^')x)..]$(mod16).fromEnum<$>x Output is 0 for balanced, -1 for left-heavy and 1 for right-heavy. Usage example: f "321^ …
answered Nov 24 '15 by nimi
Haskell, 149 144 bytes z=zip[0..] g n|f<-[(x,y,c)|(y,r)<-z$lines n,(x,c)<-z r,c>' ']=sum[c%d/sqrt((x-i)^2+(y-j)^2)|a@(x,y,c)<-f,b@(i,j,d)<-f,a/=b]/2 c%d|c==d=1|1<2= -1 Usage example: *Main> g " - … answered Dec 29 '15 by nimi Haskell, 650 bytes Task 1, 88 bytes: f n="x "++unlines(map(take 4.(++" ").show=<<)$[1..n]:map(\a->a:map(a*)[1..n])[1..n]) Task 2, 76 bytes: g s=sqrt(sum(map(fromIntegral.(^2).fromEnum)s)/sum( …
answered Nov 6 '15 by nimi