From: grrr Date: 2006-03-18T02:08:48+09:00 Subject: Card tricks with Ruby 2 - The Riffle First of all I wish to humbly send my thanks everyone taking their time to share their pearls of wisdom! You have taught me alot! Hehe my honorable mention goes to James for the cards.sort_by{ rand } which is nice and snappy. Also, I thought the 'deck = deck[x..-1] + deck[0...x]' was clear to me, even if I am a ruby newb. Now lets move on.. On Fri, 17 Mar 2006 22:14:47 +0900, dblack wrote: > I have to say, it only dawned on me just now that it's kind of funny to > cut the deck when the dealer is a computer. The idea of cutting the deck > is to thwart attempts by the dealer to stack the deck. I actually kind of > love the idea that one has to do this in the case of a computer :-) Yes, I want the whole deal to be as realistic as possible! Down to last detail! In real life cards are not really shuffled into random order! And thus theres need for realistic Riffle! 8) Around here, before any card games, after the deck has been cut into two by the dealer it is of course 'recombined' by taking the two decks, and mixing them back into one deck, in a manouver called 'the riffle'. "A riffle, in which half of the deck is held in each hand with the thumbs inward, then cards are released by the thumbs so that they fall to the table intertwined." Thus *almost* every card other card is from the other half of the deck, and vice versa - with the odd double, triple or quadruple cards sometimes falling on the table from either pack! You can find a photo and detailed description of the riffle here: http://en.wikipedia.org/wiki/Shuffle This is done three times, and finally one of the players gets to cut the deck and the dealer then recombines it and deals out cards. Ie. dealer does 'cut + riffle' three times, then player 'cuts', then dealer riffles, and game can then begin. How would you code riffle?