Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>Lua, 895</h2> <p>OK, correct now. Can even score 1 as ace.</p> <pre><code>t=table p=ipairs j=arg x={}r={}o={}b=0 function f()local e,s,n,m=0,0,{}for i,v in p(j)do s=s+v e=e+(v+0==1 and 1 or 0)n[i]=v end t.sort(n)for i,v in p(n)do if o[i]and v~=o[i]then m=v&gt;o[i]break end end while e&gt;0 and s&lt;12 do s=s+10 e=e-1 end if s&lt;=21 and s&gt;b or(s==b and(#j&gt;#r or(#j==#r and m)))then b=s for i=1,#r&gt;#j and #r or #j do r[i]=j[i]o[i]=j[i]end t.sort(o)end if s&gt;0 then for i=1,#j do t.insert(x,t.remove(j,i))f()t.insert(j,i,table.remove(x))end end end f()t={" __________ ","| |","|__________|","| /\\ |","| /\\ |","| /\\ |","| /\\ /\\ |","| \\/ /\\ \\/ |","|_\\/____\\/_|"}c={"12224D223","125E226F3","125E4D6F3","127G227G3","127G4D7G3","127G7G7G3","1278HG7G3","1278H8HG3","17G78HG79","178HG78H9"}for i=1,9 do for j,x in p(r)do v=c[tonumber(x)]:sub(i,i):byte()io.write(v&lt;64 and t[v-48]or(t[v-64]:gsub("[/\\]",{["/"]="\\",["\\"]="/"})))end io.write("\n")end </code></pre> <p>Sample output:</p> <pre><code>&gt;lua card.lua 8 9 10 7 __________ __________ | /\ /\ || /\ /\ | | \/ \/ || \/ /\ \/ | | /\ /\ || /\ \/ /\ | | \/ /\ \/ || \/ \/ | | /\ \/ /\ || /\ /\ | | \/ \/ || \/ /\ \/ | | /\ /\ || /\ \/ /\ | |_\/____\/_||_\/____\/_| &gt;lua card.lua 1 4 5 4 7 4 8 __________ __________ __________ __________ __________ | || || || || | | || /\ /\ || /\ /\ || /\ /\ || /\ /\ | | || \/ \/ || \/ \/ || \/ /\ \/ || \/ \/ | | /\ || /\ || || /\ \/ /\ || | | \/ || \/ || || \/ \/ || | | || /\ /\ || /\ /\ || /\ /\ || /\ /\ | | || \/ \/ || \/ \/ || \/ \/ || \/ \/ | |__________||__________||__________||__________||__________| &gt;lua card.lua 1 9 5 5 __________ __________ __________ | || || | | || /\ /\ || /\ /\ | | || \/ \/ || \/ \/ | | /\ || /\ || /\ | | \/ || \/ || \/ | | || /\ /\ || /\ /\ | | || \/ \/ || \/ \/ | |__________||__________||__________| </code></pre>
 

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