# File lib/quiz1/t/solutions/Jamis Buck/lib/cipher.rb, line 10 def cipher_shuffle! # move joker A down one card, circularly reposition_card( "A", 1 ) # move joker B down two cards, circularly reposition_card( "B", 2 ) joker_A = @deck.index( "A" ) joker_B = @deck.index( "B" ) # move all cards above the top-most joker, below the bottom-most joker, and # all cards below the bottom-most joker, above the top-most joker. top = ( joker_A < joker_B ? joker_A : joker_B ) bottom = ( joker_A > joker_B ? joker_A : joker_B ) @deck = @deck[bottom+1..-1] + @deck[top..bottom] + @deck[0,top] # take value of the bottom-most card, and cut that many cards off the # top, inserting them just before the bottom-most card. cut = @deck.last @deck = @deck[cut..-2] + @deck[0,cut] + [ @deck.last ] end