# File lib/quiz1/t/solutions/Bill Guindon/solitaire.rb, line 162 def shift_card(name, suit, count) # find the card idx = @deck.find_card(name, suit) # remove it from the deck. card = @deck.cards.slice!(idx) # calculate new placement. idx += count # the slice above makes length 'look' zero-based idx -= @deck.cards.length if idx > @deck.cards.length # glue the deck together as cards before, card, cards after. @deck.cards = @deck.cards[0...idx] + [card] + @deck.cards[idx...@deck.cards.length] end