Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int bottomDeckCount = 0;
- int topDeckCount = 0;
- Card[] shuffled = new Card[cards.length];
- for (int i = 0; i < cards.length; i++) {
- if (i % 2 == 0 && i != 1) {
- shuffled[i] = cards[topDeckCount];
- bottomDeckCount++;
- } else if (cards.length % 2 == 0){
- shuffled[i] = cards[bottomDeckCount + (cards.length / 2) - 1];
- topDeckCount++;
- } else {
- shuffled[i] = cards[bottomDeckCount + (cards.length / 2)];
- topDeckCount++;
- }
- }
- cards = shuffled;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement