lib/patience/event_handlers/drop.rb
# Adds dropped card to one of Tableau's piles, if it's
# possible. If not, calls off card to it's initital position.
Adds dropped card to one of Tableau's piles, if it's
possible. If not, calls off card to it's initital position.
Adds dropped card to one of Tableau ' s piles if it ' s possible . If not calls off card to it ' s initital position .
def put_in_tableau
        if can_put_in_tableau?
          @cards.keys.each_with_index do |card, i|
            add_to_pile_beneath(card)
            if @pile_beneath.size == 1 
              card.pos = @pile_beneath.pos + [0, i*19]
            else
              card.pos = @pile_beneath.cards[-2].pos + [0, 19]
            end
            @pile.cards.last.face_up unless @pile.empty?
          end
        else
          call_off
        end
      end
def put_in_tableau if can_put_in_tableau? @cards . keys . each_with_index do | card , i | add_to_pile_beneath ( card ) if @pile_beneath . size == 1 card . pos = @pile_beneath . pos + [ 0 , i * 19 ] else card . pos = @pile_beneath . cards [ - 2 ] . pos + [ 0 , 19 ] end @pile . cards . last . face_up unless @pile . empty? end else call_off end end
Adds dropped card to one of Tableau's piles, if it's
possible.
Adds dropped card to one of Tableau ' s piles if it ' s possible .
# It was empty one line before.