vendor/gems/rubyzip-0.9.1/lib/quiz1/t/solutions/Jim Menard/solitaire_cypher.rb
# Move a card a certain distance. Wrap around the end of the deck.
Move a card a certain distance. Wrap around the end of the deck.
Move a card a certain distance . Wrap around the end of the deck .
def move(card, distance)
	old_pos = @cards.index(card)
	new_pos = old_pos + distance
	new_pos -= (@cards.length-1) if new_pos >= @cards.length
	@cards[old_pos,1] = []
	@cards[new_pos,0] = [card]
    end
def move ( card , distance ) old_pos = @cards . index ( card ) new_pos = old_pos + distance new_pos -= ( @cards . length - 1 ) if new_pos >= @cards . length @cards [ old_pos , 1 ] = [ ] @cards [ new_pos , 0 ] = [ card ] end
Move a card a certain distance.
Move a card a certain distance .
card
<not_specific>
distance
<not_specific>