After all the piles have been reversed the new order will be first card of the first pile , second card of the first pile , ... , last pile of the last pile ( from top to bottom )
int pileNo = 0 ; i = 0 ; j = 0 ; while ( i < CARDS ) { list . Insert ( i , piles [ pileNo ] [ j ] ) ; j ++ ; if ( j >= piles [ pileNo ] . Count ) { pileNo ++ ; j = 0 ; } i ++ ; } }