lib/patience/event_handlers/drop.rb
# Finds a pile beneath the dropped card.
Finds a pile beneath the dropped card.
Finds a pile beneath the dropped card .
def find_pile_beneath
        king_or_ace = @card_to_drop.rank.king? || @card_to_drop.rank.ace?
        detect_in(@areas, :pile) do |pile|
          pile != @pile && pile.overlaps?(@card_to_drop) &&
          (if king_or_ace
             pile.empty? || (@card_beneath && @card_beneath.rank.queen?)
           else
             pile.cards.include?(@card_beneath)
           end)
        end
      end
def find_pile_beneath king_or_ace = @card_to_drop . rank . king? || @card_to_drop . rank . ace? detect_in ( @areas , :pile ) do | pile | pile != @pile && pile . overlaps? ( @card_to_drop ) && ( if king_or_ace pile . empty? || ( @card_beneath && @card_beneath . rank . queen? ) else pile . cards . include? ( @card_beneath ) end ) end end
Finds a pile beneath the dropped card.
Finds a pile beneath the dropped card .
# Find out, if dropped card is a king or an ace. # If dropped card is a king or an ace, don't # check, whether a pile includes card beneath.