A possible better approach is to use @deck.cards.each_with_index.