ArrayList<Card> player1Cards = new ArrayList<Card>();
ArrayList<Card> player2Cards = new ArrayList<Card>();
for (int i = 4; i < 9;) {
Suit suit = Enum.valueOf(Suit.class, tokens[i]);
Rank rank = Enum.valueOf(Rank.class, tokens[i + 1]);
Card card = new Card(suit, rank);
dealerCards.add(card);
i += 2;
}
state.setDealerCards(dealerCards);
for (int i = 10; i < 15;) {
Suit suit = Enum.valueOf(Suit.class, tokens[i]);
Rank rank = Enum.valueOf(Rank.class, tokens[i + 1]);
Card card = new Card(suit, rank);
player1Cards.add(card);
i += 2;
}
state.setPlayerCards(0, player1Cards);
for (int i = 16; i < 21;) {
Suit suit = Enum.valueOf(Suit.class, tokens[i]);
Rank rank = Enum.valueOf(Rank.class, tokens[i + 1]);
Card card = new Card(suit, rank);
player2Cards.add(card);
i += 2;
}
state.setPlayerCards(1, player2Cards);