Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Haskell</h2> <pre><code>import Data.List f=[(628,6,6,3,33),(586,7,11,11,23),(185,-1,17,24,28),(189,14,10,50,83),(180,7,5,70,77),(538,-7,7,70,105),(510,-11,19,71,106),(220,-9,7,77,100),(136,4,14,80,91),(337,-13,20,106,128)] c=filter d=True e=map a(_,_,_,t,_)=t b(_,_,_,_,t)=t aa(_,y,_,_)=y ab(x,t,y,_,u)=(x,0,t,y,u) ac(x,y,t,u,_)=[(x,y,t+20,u+10),(x,y,t,u+10),(x,y,t-20,u+10),(x,y,t+20,u),(x,y,t,u),(x,y,t-20,u),(x,y,t+20,u-10),(x,y,t,u-10),(x,y,t-20,u-10)] g(x,y,t,u,v)=(x+t,y+u,t,u,v) h(x,y,t,u)=(x+t,y+u,t,u-2) i=(1,f,[],[]) j s 0=s j(t,u,v,w)i=j(t+1,c((/=t).a)u,c((&gt; t).b)x++(e ab.c((==t).a))u,c((&gt;0).aa)(e h w)++(concat.e ac.c((==t).b))x)(i-1) where x=e g v k x y |x==0='|' |3*abs y&lt;=abs x='-' |3*abs x&lt;=abs y='|' |(y&lt;0&amp;&amp;x&gt;0)||(y&gt;0&amp;&amp;x&lt;0)='\\' |d='/' l(x,y,t,u,_)=m(x,y,t,u) m(x,y,t,u)=(div x 10,23-div y 10,k t u) n(x,y,_)(u,v,_) |z==EQ=compare x u |d=z where z=compare y v o((x,y,t):(u,v,w):z) |x==u&amp;&amp;y==v=o((x,y,'X'):z) |d=(x,y,t):(o((u,v,w):z)) o x=x q _ y [] |y==23="" |d='\n':(q 0(y+1)[]) q v u((x,y,z):t) |u&gt;22="" |v&gt;78='\n':(q 0(u+1)((x,y,z):t)) |u/=y='\n':(q 0(u+1)((x,y,z):t)) |v/=x=' ':(q(v+1)u((x,y,z):t)) |d = z:(q(v+1)u t) p(_,_,v,w)=q 0 0((c z.o.sortBy n)((e l v)++(e m w))) where z(x,y,_)=x&gt;=0&amp;&amp;x&lt;79&amp;&amp;y&gt;=0 r x=do{z &lt;- getChar;(putStr.p)x} s=e(r.j i)[1..] main=foldr(&gt;&gt;)(return())s </code></pre> <p>Not nearly as impressive as MizardX's, coming in at 1068 characters if you remove the <code>f=…</code> declaration, but hell, it was fun. It's been a while since I've had a chance to play with Haskell.</p> <p>The (slightly) prettier version is <a href="http://cid-40894d4d90339812.skydrive.live.com/self.aspx/.Public/firewrks.hs" rel="nofollow noreferrer" title="Pretty(er) Haskell script">also available</a>.</p> <p>Edit: Ack. Rereading, I don't quite meet the spec.: this version prints a new screen of firework display every time you press a key, and requires <code>^C</code> to quit; it doesn't take a command line argument and print out the relevant screen.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload