Class: Klondike::MarkPlace

Inherits:
CardPlace show all
Defined in:
lib/rubysketch/solitaire/klondike.rb

Instance Attribute Summary

Attributes inherited from CardPlace

#cards, #name

Instance Method Summary collapse

Methods inherited from CardPlace

#add, #id, #initialize, #inspect, #pop, #posFor, #sprite, #updateCards

Methods included from HasSprite

#hit?

Constructor Details

This class inherits a constructor from CardPlace

Instance Method Details

#accept?(x, y, card) ⇒ Boolean

Returns:

  • (Boolean)


936
937
938
939
940
941
942
943
# File 'lib/rubysketch/solitaire/klondike.rb', line 936

def accept?(x, y, card)
  return false if !card || card.closed? || !card.canDrop?
  hit?(x, y) &&
    card.last? &&
    card.opened? &&
    (!mark || mark == card.mark) &&
    card.number == last&.number.then {|n| n ? n + 1 : 1}
end

#markObject



932
933
934
# File 'lib/rubysketch/solitaire/klondike.rb', line 932

def mark()
  last&.mark
end