package Engine;

import java.util.ArrayList;
import java.util.List;

public class Hand {
    private List<Card> cards = new ArrayList<Card>();

    // Constructor
    public Hand(ArrayList<Card> cards) {
        this.cards = cards;
    }

    // Called when player wants to hit
    public void addCard(Card card) {
        cards.add(card);
    }

    // Returns an array of length 1 or 2 containing possible values of the hand
    public int[] getValues() {
        int val0 = 0; // Hand value assuming first ace is valued at 1
        int val1 = 0; // Hand value assuming first ace is valued at 11
        boolean hasAce = false;
        int[] cardValue;

        for(int i=0; i<cards.size(); i++) {
            cardValue = cards.get(i).getValues();

            // If Ace
            if(cardValue.length == 2) {
                // If Ace already exists in hand, just add 1
                if(hasAce) {
                    val0 += cardValue[0]; // 1
                    val1 += cardValue[0]; // 1
                }
                else {
                    val0 += cardValue[0]; // 1
                    val1 += cardValue[1]; // 11
                    hasAce = true;
                }
            }

            // Otherwise single-value cards (2-10, J, Q, K)
            else {
                val0 += cardValue[0];
                val1 += cardValue[0];
            }
        }

        if(val0 == val1) {
            return new int[] { val0 };
        }
        else {
            return new int[] {val0, val1};
        }
    }

    // TODO
   public Hand split() {
        if(cards.size() != 2) {
            return null;
        }

        Hand[] newHands = new Hand[2];
        ArrayList<Card> cardForHand0 = new ArrayList<Card>();
        ArrayList<Card> cardForHand1 = new ArrayList<Card>();


        newHands[0] = new Hand();

        

   }
}

@@ -1,21 +1,4 @@
-package Engine;%0A%0A
 impo
@@ -637,107 +637,8 @@
 e;%0A%0A
-        for(int i=0; i%3Ccards.size(); i++) %7B%0A            cardValue = cards.get(i).getValues();%0A%0A    
     
@@ -655,28 +655,24 @@
 Ace%0A        
- 
-   
 if(cardValue
@@ -683,28 +683,24 @@
 gth == 2) %7B%0A
-    
             
@@ -744,20 +744,16 @@
 t add 1%0A
-    
         
@@ -777,36 +777,32 @@
                 
-    
 val0 += cardValu
@@ -804,36 +804,32 @@
 dValue%5B0%5D; // 1%0A
-    
                 
@@ -863,34 +863,26 @@
             
-   
- 
 %7D%0A
-    
             
@@ -880,36 +880,32 @@
          else %7B%0A
-    
                 
@@ -939,36 +939,32 @@
                 
-  
-  
 val1 += cardValu
@@ -991,20 +991,16 @@
         
-    
 hasAce =
@@ -1010,36 +1010,32 @@
 ue;%0A            
-    
 %7D%0A            %7D%0A
@@ -1024,35 +1024,27 @@
   %7D%0A        
- 
-   %7D%0A%0A    
+%7D%0A%0A
         // O
@@ -1087,20 +1087,16 @@
 , Q, K)%0A
-    
         
@@ -1106,36 +1106,32 @@
 e %7B%0A            
-    
 val0 += cardValu
@@ -1140,36 +1140,32 @@
 0%5D;%0A            
-    
 val1 += cardValu
@@ -1170,30 +1170,16 @@
 lue%5B0%5D;%0A
-            %7D%0A
         
@@ -1640,19 +1640,8 @@
 ();%0A
-%0A        %0A%0A
    %7D

Fix conflicts