Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1.     int bottomDeckCount = 0;
  2.         int topDeckCount = 0;
  3.         Card[] shuffled = new Card[cards.length];
  4.         for (int i = 0; i < cards.length; i++) {
  5.             if (i % 2 == 0 && i != 1) {
  6.                 shuffled[i] = cards[topDeckCount];
  7.                 bottomDeckCount++;
  8.             } else if (cards.length % 2 == 0){
  9.                 shuffled[i] = cards[bottomDeckCount + (cards.length / 2) - 1];
  10.                 topDeckCount++;
  11.             } else {
  12.                 shuffled[i] = cards[bottomDeckCount + (cards.length / 2)];
  13.                 topDeckCount++;
  14.             }
  15.         }  
  16.         cards = shuffled;
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement