I have a an array of deck of 52 cards.
I would like to have a method that I can mix the cards up following a strategic placement of the cards.
First I separate the cards into to packets like this:
Card[] packetOne = new Card[cards.length / 2];
Card[] packetTwo = new Card[cards.length / 2];
for (int i = 0; i < (cards.length / 2); i++) {
packetOne[i] = cards[i];
}
for (int i = 0; i < packetTwo.length; i++) {
for (int c = cards.length / 2; c < cards.length; c++) {
packetTwo[i] = cards[c];
}
}
Now that the cards are into two piles, I would like to sort the cards in a new array so that: the first card in packet one is first and after that the first card in packet two, and after that the 2nd card in packet one and after this card the 2nd card in packet two, etc,etc,etc until all cards are done.
Also if the number of cards in the deck at any time is odd, the first packet will have one more card than the second packet but the same sorting idea.
Does anyone know how to do this type of thing?