I should be able to figure this out, but I'm completely lost.
The following code deals to a hand of choice a set number of cards (int toDeal):
private void deal(Hand hand, int toDeal) { for (int j = 0; j < toDeal; j++) { Hand temp = hand.handCards(); Card[] s = new Card[temp.getNumCards() + 1]; Card[] q = hand.getHand(); for (int k = 0; k < temp.getNumCards(); k++) { s[k] = q[k]; } s[s.length - 1] = deck.dealCard(); hand.setHand(s); } }
to call it I run:
deal(playerHand, 5);
How do I make a method to add these cards back into the deck (the cards from the temp array)?
Thank you,
any ideas or code greatly appreciated
-sp4ce