title: Code Golf: Diamond Blackjack
body: <h2>The challenge</h2>
  
  <p>The shortest code by character count to output a best-case blackjack hand from the list of number-cards given.</p>
  
  <p>Input is a list of numbers from 1 to 10 (inclusive) separated by space.</p>
  
  <p>Output will be the best blackjack hand formed from that list of cards - the closest available combo to reach 21 by the sum of all card values without surpassing it. Cards can be removed but not added.</p>
  
  <p>If a case where removing two or more cards in favor of one card to accomplish the same result (removing 5 or 4,1 to gain 21) removing the least cards is required. 
  If the equal amount of cards is to be removed (removing 1,4 or 3,2) the group with the minimum of the minimum will be removed (in the previous example, 1,4 will be removed as <code>min(min(3,2), min(1,4))</code> belongs to that pair). In the case of duplicate cards, the first encounter should be removed.</p>
  
  <p>Output will be formed as diamond cards, with input order preserved:</p>
  
  <pre>
   __________  __________ 
  |          ||          |
  |          || /\       |
  |          || \/       |
  |    /\    ||          |
  |    \/    ||          |
  |          ||       /\ |
  |          ||       \/ |
  |__________||__________|
   __________  __________ 
  |          ||          |
  | /\       || /\    /\ |
  | \/       || \/    \/ |
  |    /\    ||          |
  |    \/    ||          |
  |       /\ || /\    /\ |
  |       \/ || \/    \/ |
  |__________||__________|
   __________  __________ 
  |          ||          |
  | /\    /\ || /\    /\ |
  | \/    \/ || \/    \/ |
  |    /\    || /\    /\ |
  |    \/    || \/    \/ |
  | /\    /\ || /\    /\ |
  | \/    \/ || \/    \/ |
  |__________||__________|
   __________  __________ 
  |          ||          |
  | /\    /\ || /\    /\ |
  | \/ /\ \/ || \/ /\ \/ |
  | /\ \/ /\ || /\ \/ /\ |
  | \/    \/ || \/ /\ \/ |
  | /\    /\ || /\ \/ /\ |
  | \/    \/ || \/    \/ |
  |__________||__________|
   __________  __________ 
  | /\    /\ || /\    /\ |
  | \/    \/ || \/ /\ \/ |
  | /\    /\ || /\ \/ /\ |
  | \/ /\ \/ || \/    \/ |
  | /\ \/ /\ || /\    /\ |
  | \/    \/ || \/ /\ \/ |
  | /\    /\ || /\ \/ /\ |
  |_\/____\/_||_\/____\/_|
  </pre>
  
  <h2>Test cases</h2>
  
  <pre><code>Input:
      1 5 7 8
  Output:
       __________  __________  __________  __________ 
      |          ||          ||          ||          |
      |          || /\    /\ || /\    /\ || /\    /\ |
      |          || \/    \/ || \/ /\ \/ || \/ /\ \/ |
      |    /\    ||    /\    || /\ \/ /\ || /\ \/ /\ |
      |    \/    ||    \/    || \/    \/ || \/ /\ \/ |
      |          || /\    /\ || /\    /\ || /\ \/ /\ |
      |          || \/    \/ || \/    \/ || \/    \/ |
      |__________||__________||__________||__________|
  </code></pre>
  
  <hr>
  
  <pre><code>Input: 
      10 3 4 2 6
  Output:
       __________  __________  __________  __________ 
      | /\    /\ ||          ||          ||          |
      | \/ /\ \/ || /\       || /\       || /\    /\ |
      | /\ \/ /\ || \/       || \/       || \/    \/ |
      | \/    \/ ||    /\    ||          || /\    /\ |
      | /\    /\ ||    \/    ||          || \/    \/ |
      | \/ /\ \/ ||       /\ ||       /\ || /\    /\ |
      | /\ \/ /\ ||       \/ ||       \/ || \/    \/ |
      |_\/____\/_||__________||__________||__________|
  </code></pre>
  
  <hr>
  
  <pre><code>Input 
      5 10 5 2 3
  Output:
       __________  __________  __________  __________ 
      | /\    /\ ||          ||          ||          |
      | \/ /\ \/ || /\    /\ || /\       || /\       |
      | /\ \/ /\ || \/    \/ || \/       || \/       |
      | \/    \/ ||    /\    ||          ||    /\    |
      | /\    /\ ||    \/    ||          ||    \/    |
      | \/ /\ \/ || /\    /\ ||       /\ ||       /\ |
      | /\ \/ /\ || \/    \/ ||       \/ ||       \/ |
      |_\/____\/_||__________||__________||__________|
  </code></pre>
  
  <p>Code count includes input/output (i.e full program).</p>