lib/patience/pile.rb
def overlaps?(other_card)
      if cards.empty?
        background.to_rect.collide?(other_card)
      else
        cards.find { |card| card.face_up? and card.overlaps?(other_card) }
      end
    end
# Public: Check, whether the pile overlaps (collides) the given card,
# by comparing the position of the card and the pile.
#
# other_card - The Card, which should be checked, if it's colliding with the
#              pile.
#
# Returns the result of collision detection of the other_card and the
# background of the pile, if the pile is empty. If the pile isn't empty,
# tries to find a card, which overlaps other_card.
Check, whether the pile overlaps (collides) the given card,
by comparing the position of the card and the pile.

The Card, which should be checked, if it's colliding with the
pile.

Returns the result of collision detection of the other_card and the
background of the pile, if the pile is empty. If the pile isn't empty,
tries to find a card, which overlaps other_card.
Check whether the pile overlaps ( collides ) the given card by comparing the position of the card and the pile . The Card which should be checked if it ' s colliding with the pile . Returns the result of collision detection of the other_card and the background of the pile if the pile is empty . If the pile isn ' t empty tries to find a card which overlaps other_card .
def overlaps?(other_card)
      if cards.empty?
        background.to_rect.collide?(other_card)
      else
        cards.find { |card| card.face_up? and card.overlaps?(other_card) }
      end
    end
def overlaps? ( other_card ) if cards . empty? background . to_rect . collide? ( other_card ) else cards . find { | card | card . face_up? and card . overlaps? ( other_card ) } end end
Public: Check, whether the pile overlaps (collides) the given card,
by comparing the position of the card and the pile.
Public : Check whether the pile overlaps ( collides ) the given card by comparing the position of the card and the pile .
other_card