title: Choose 3 elements from an Array List by conditions
body: <p>I'm making a java card game and now I try to create "a brain" for computer player. Conditions:</p>
  
  <ul>
  <li><p>on the table there are 3 cards (only value, not suit);</p></li>
  <li><p>computer player (CP) has 6 cards;</p></li>
  <li><p>to win a round CP has to beat at least 2 cards on the table, or it<br>
  has to beat 1 card and make a draw with another 2 cards;</p></li>
  <li><p>of course, card set must be optimal.</p></li>
  </ul>
  
  <p>Example:
  on the table are cards with value 1, 2, 3. CP has cards with value 1, 1, 3, 2, 5, 6. It has to choose card with value 2 to beat Card1, than choose card with value 3 to beat Card2 and than choose card with value 1, because it has already beat 2 cards.
  Now i wrote the next code, but it's not working true or not working at all.</p>
  
  <pre><code>for (i = 0, j = i++, k = j++; i &lt; oppHand.size() - 2 &amp;&amp; j &lt; oppHand.size() - 1 &amp;&amp; k &lt; oppHand.size(); i++) {
  
  a = oppHand.get(i).getPower(); //value of card1 from CP hand
  b = oppHand.get(j).getPower(); //value of card2 from CP hand
  c = oppHand.get(k).getPower(); //value of card3 from CP hand
  
  x = oppHand.indexOf(i);        //position of card1 in a CP hand
  y = oppHand.indexOf(j);        //position of card2 in a CP hand
  z = oppHand.indexOf(k);        //position of card3 in a CP hand
  
  if (a &gt; Score1 &amp;&amp; b &gt; Score2 ||  a&gt; Score1 &amp;&amp; c &gt; Score3) {    //Score - value of the cards on the table
  choice1 = x;
  choice2 = y;
  choice3 = z;}
  
  else if (a &gt; Score1 &amp;&amp; b &gt; Score3 || a &gt; Score1 &amp;&amp; c &gt; Score2) {
  choice1 = x;
  choice2 = z;
  choice3 = y;} ........
  
  // moving cards from the CP hand to the table with assignment values to the piles
      validPower5 = oppHand.get(choice1).getPower();  
      discardPile5.add(0, oppHand.get(choice1));
      oppHand.remove(choice1);
  
      validPower6 = oppHand.get(choice2).getPower();  
      discardPile6.add(0, oppHand.get(choice2));
      oppHand.remove(choice2);
  
      validPower7 = oppHand.get(choice3).getPower();  
      discardPile7.add(0, oppHand.get(choice3));
      oppHand.remove(choice3);
                      }
  </code></pre>