lib/patience/event_handlers/drop.rb
def find_card_beneath
        all_tail_cards = @areas.values.flat_map do |area|
          area.piles.map { |pile| pile.cards.last }
        end.compact

        # Iterate only over tail cards.
        all_tail_cards.find do |card|
          area = detect_in(@areas, :area) { |area| area.cards.include?(card)}
          card.face_up? && card.overlaps?(@card_to_drop) &&
          (case area
            when Tableau then tableau_conditions?(card)
            when Foundation then foundation_conditions?(card)
          end)
        end
      end
# Finds a card beneath the dropped card.
Finds a card beneath the dropped card.
Finds a card beneath the dropped card .
def find_card_beneath
        all_tail_cards = @areas.values.flat_map do |area|
          area.piles.map { |pile| pile.cards.last }
        end.compact
        all_tail_cards.find do |card|
          area = detect_in(@areas, :area) { |area| area.cards.include?(card)}
          card.face_up? && card.overlaps?(@card_to_drop) &&
          (case area
            when Tableau then tableau_conditions?(card)
            when Foundation then foundation_conditions?(card)
          end)
        end
      end
def find_card_beneath all_tail_cards = @areas . values . flat_map do | area | area . piles . map { | pile | pile . cards . last } end . compact all_tail_cards . find do | card | area = detect_in ( @areas , :area ) { | area | area . cards . include? ( card ) } card . face_up? && card . overlaps? ( @card_to_drop ) && ( case area when Tableau then tableau_conditions? ( card ) when Foundation then foundation_conditions? ( card ) end ) end end
Finds a card beneath the dropped card.
Finds a card beneath the dropped card .
# Iterate only over tail cards.