package Engine;

import java.util.ArrayList;

/* Skeleton code for the Game class*/

public class BasicStrategy {

  public static Move nextMove(Hand playerHand, Card dealerCard) {
    int playerIndex = BasicStrategy.getPlayerIndex(playerHand);
    int dealerIndex = BasicStrategy.getDealerIndex(dealerCard);
    return BasicStrategy.moveInTable(playerHand, dealerIndex);
  }

  public int getPlayerIndex(Hand playerHand) {
    // A, A
    if(playerHand.size() == 2 && playerHand.get(0).rank() == "A" && playerHand.get(1).rank() == "A")
      return 30;

    // T, T
    else if(Array.equals(playerHand.getValues(), new int[] {20}
      return 29;

    // A + something
    else if(Array.equals(playerHand.getValues(), new int[] {3, 13}) // A, 2
      return 13;    
    else if(Array.equals(playerHand.getValues(), new int[] {4, 14}) // A, 3
      return 14;
    else if(Array.equals(playerHand.getValues(), new int[] {5, 15}) // A, 4
      return 15;
    else if(Array.equals(playerHand.getValues(), new int[] {6, 16}) // A, 5
      return 16;
    else if(Array.equals(playerHand.getValues(), new int[] {7, 17}) // A, 6
      return 17;
    else if(Aray.equals(playerHand.getValues(), new int[] {8, 18}) // A, 7
      return 18;
    else if(Array.equals(playerHand.getValues(), new int[] {9, 19}) // A, 8
      return 19;
    else if(Array.equals(playerHand.getValues(), new int[] {10, 20)} // A, 9
      return 20;
    
    // Doubles
    else if(playerHand.size() == 2 && playerHand.get(0).rank() == playerHand.get(1).rank()) {
      if(Array.equals(playerHand.getValues(), new int[] {4})
        return 21;
      else if(Array.equals(playerHand.getValues(), new int[] {6})
        return 22;
      else if(Array.equals(playerHand.getValues(), new int[] {8})
        return 23;
      else if(Array.equals(playerHand.getValues(), new int[] {10})
        return 24;
      else if(Array.equals(playerHand.getValues(), new int[] {12})
        return 25;
      else if(Array.equals(playerHand.getValues(), new int[] {14})
        return 26;
      else if(Array.equals(playerHand.getValues(), new int[] {16})
        return 27;
      else if(Array.equals(playerHand.getValues(), new int[] {18})
        return 28;
    }

    else {
      return Integer.parseInt(playerHand.getValues().get(0)) - 5;
    }
  }

  public int getDealerIndex(Card dealerCard) {
    if(dealerCard.rank() == "A")
      return 9;
    else
      return Integer.parseInt(dealerCard.rank()) - 2;
  }

  public static String moveInTable(playerIndex, dealerIndex) {
    Move[][] table =
      { {'H', 'H', 'H', 'H','H', 'H', 'H', 'H', 'H', 'H'}, // 5
        {'H', 'H', 'H', 'H','H', 'H', 'H', 'H', 'H', 'H'}, // 6
        {'H', 'H', 'H', 'H','H', 'H', 'H', 'H', 'H', 'H'}, // 7
        {'H', 'H', 'H', 'H','H', 'H', 'H', 'H', 'H', 'H'}, // 8
        {'H', 'D', 'D', 'D', 'D', 'H', 'H', 'H', 'H', 'H'}, // 9
        {'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'H', 'H'}, // 10
        {'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'H'}, // 11
        {'H', 'D', 'D', 'D', 'D', 'H', 'H', 'H', 'H', 'H'}, // 12


      }
  }


2 3 4 5 6 7 8 9 10  A
5 H H H H H H H H H H
6 H H H H H H H H H H
7 H H H H H H H H H H
8 H H H H H H H H H H
9 H D D D D H H H H H
10  D D D D D D D D H H
11  D D D D D D D D D H
12  H H S S S H H H H H
13  S S S S S H H H H H
14  S S S S S H H H H H
15  S S S S S H H H H H
16  S S S S S H H H H H
17  S S S S S S S S S S
A,2 H H H D D H H H H H
A,3 H H H D D H H H H H
A,4 H H D D D H H H H H
A,5 H H D D D H H H H H
A,6 H D D D D H H H H H
A,7 S DS  DS  DS  DS  S S H H H
A,8 S S S S S S S S S S
A,9 S S S S S S S S S S
2,2 P P P P P P H H H H
3,3 P P P P P P H H H H
4,4 H H H P P H H H H H
5,5 D D D D D D D D H H
6,6 P P P P P H H H H H
7,7 P P P P P P H H H H
8,8 P P P P P P P P P P
9,9 P P P P P S P P S S
T,T S S S S S S S S S S
A,A P P P P P P P P P P
}
@@ -640,16 +640,23 @@
 turn 29;
+%0A      
 %0A%0A    //

Create bs