Решение на Четвърта задача от Веселин Русинов

Обратно към всички решения

Към профила на Веселин Русинов

Резултати

  • 2 точки от тестове
  • 0 бонус точки
  • 2 точки общо
  • 16 успешни тест(а)
  • 41 неуспешни тест(а)

Код

class Card
attr_reader :rank, :suit
ALL_RANKS = [2, 3, 4, 5, 6, 7, 8, 9, 10, :jack, :queen, :king, :ace]
BELOTE_RANKS = [7, 8, 9, :jack, :queen, :king, 10, :ace]
SIXTY_SIX_RANKS = [9, :jack, :queen, :king, 10, :ace]
SUITS = [:clubs, :diamonds, :hearts, :spades]
SUIT_VALUES = { :clubs => 20, :diamonds => 30, :hearts => 40, :spades => 50 }
def initialize(rank, suit)
@rank, @suit = rank, suit
end
def <=>(other)
[SUITS.index(other.suit), ALL_RANKS.index(other.rank)] <=>
[SUITS.index(@suit), ALL_RANKS.index(@rank)]
end
def to_s()
"#{@rank.to_s.capitalize} of #{@suit.to_s.capitalize}"
end
def suite_index()
SUITS.index(@suit)
end
def belote_rank()
BELOTE_RANKS.index(@rank)
end
def same_suit(others)
others.any? { |other| suite_index == other.suite_index }
end
def index()
ALL_RANKS.index(@rank) + 2 + SUIT_VALUES[@suit]
end
end
class Hand
def initialize(cards)
@cards = cards
end
def size()
@cards.size
end
def play_card()
@cards.pop
end
def allow_face_up?()
@cards.size <= 3
end
def highest_of_suit(suit)
if (@cards.any? { |card| card.suit == suit} )
suits = @cards.select { |card| card.suit == suit }
return suits.sort.first
end
end
def belote?()
kings = @cards.select do |card|
card.belote_rank == Card::BELOTE_RANKS.index(:king)
end
queens = @cards.select do |card|
card.belote_rank == Card::BELOTE_RANKS.index(:queen)
end
kings.select { |king| king.same_suit(queens) }.length > 0
end
def check(cards, count)
if (cards.size < count)
return false
end
if (cards[0] + count - 1 == cards[count - 1])
return true
end
return check(cards.take(cards.length - 1).to_a, count)
end
def tierce?()
cards = @cards.dup
check(cards.sort.reverse.map(&:index).to_a, 3)
end
def quarte?()
cards = @cards.dup
check(cards.sort.reverse.map(&:index).to_a, 4)
end
def quint?()
cards = @cards.dup
check(cards.sort.reverse.map(&:index).to_a, 5)
end
def four_of_a_kind?(rank)
dummy_card = Card.new(rank, :spades)
fours = @cards.select do |card|
card.belote_rank == dummy_card.belote_rank
end
fours != nil ? fours.size == 4 : false
end
def carre_of_jacks?()
four_of_a_kind?(:jack)
end
def carre_of_nines?()
four_of_a_kind?(9)
end
def carre_of_aces?()
four_of_a_kind?(:ace)
end
def twenty?(trump_suit)
no = @cards.select{ |card| card != trump_suit }
king_card = Card.new(:king, :spades)
queen_card = Card.new(:queen, :spades)
kings = no.select { |card| card.belote_rank == king_card.belote_rank}
queens = no.select { |card| card.belote_rank == queen_card.belote_rank}
kings.any? { |king| king.same_suit(queens) }
end
def forty?(trump_suit)
trump = @cards.select { |card| card.suit == trump_suit }
king_card = Card.new(:king, :spades)
queen_card = Card.new(:queen, :spades)
kings = trump.select { |card| card.belote_rank == king_card.belote_rank }
queens = trump.select { |card| card.belote_rank == queen_card.belote_rank }
kings.any? { |king| king.same_suit(queens) }
end
end
class Deck
include Enumerable
alias_method :top_card, :first
def initialize(cards = nil)
@cards = (cards || generate_all_cards)
end
def each(&block)
@cards.map do |card|
yield card
end
end
def size()
@cards.size
end
def draw_top_card()
@cards.shift
end
def draw_bottom_card()
@cards.pop
end
def top_card()
@cards.last
end
def bottom_card()
@cards.first
end
def shuffle()
@cards = @cards.shuffle
end
def sort()
@cards = @cards.sort
end
def to_s()
@cards.map(&:to_s).join("\n")
end
def deal(number)
Hand.new(@cards.pop(number))
end
private
def generate_all_cards
Card::ALL_RANKS.product(Card::SUITS).map { |card| Card.new(*card) }.shuffle
end
def generate_belote_cards
Card::BELOTE_RANKS.product(Card::SUITS).map do |card|
Card.new(*card)
end.shuffle
end
def generate_sixty_six_cards
Card::SIXTY_SIX_RANKS.product(Card::SUITS).map do |card|
Card.new(*card)
end.shuffle
end
end
class WarDeck < Deck
def deal
super(26)
end
end
class BeloteDeck < Deck
def initialize()
super(generate_belote_cards)
end
def deal
super(8)
end
end
class SixtySixDeck < Deck
def initialize()
super(generate_sixty_six_cards)
end
def deal
super(6)
end
end

Лог от изпълнението

..F.F...FF......FFFFFFF.FF.FFFFFFFFFFFFFFFFFFFFFFF.FF.FFF

Failures:

  1) Card #== compares two cards by their rank and suit
     Failure/Error: expect(Card.new(4, :spades)).to eq Card.new(4, :spades)
       
       expected: #<Card:0x007f27d5fdce20 @rank=4, @suit=:spades>
            got: #<Card:0x007f27d5fdd2d0 @rank=4, @suit=:spades>
       
       (compared using ==)
       
       Diff:
       @@ -1,2 +1,2 @@
       -#<Card:0x007f27d5fdce20 @rank=4, @suit=:spades>
       +#<Card:0x007f27d5fdd2d0 @rank=4, @suit=:spades>
     # /tmp/d20151112-27349-1ukcrir/spec.rb:131:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  2) WarDeck behaves like a deck fills the deck if no initialize parameters are given
     Failure/Error: expect(deck.to_a).to match_array all_available_cards
       expected collection contained:  [#<Card:0x007f27d6e24b40 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6e24b90 @rank=:king, @suit=:spades>, #<Card:0x007f27d6e24be0 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6e24c30 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6e24c80 @rank=10, @suit=:spades>, #<Card:0x007f27d6e24cd0 @rank=9, @suit=:spades>, #<Card:0x007f27d6e24d20 @rank=8, @suit=:spades>, #<Card:0x007f27d6e24d70 @rank=7, @suit=:spades>, #<Card:0x007f27d6e24dc0 @rank=6, @suit=:spades>, #<Card:0x007f27d6e24e10 @rank=5, @suit=:spades>, #<Card:0x007f27d6e24e60 @rank=4, @suit=:spades>, #<Card:0x007f27d6e24eb0 @rank=3, @suit=:spades>, #<Card:0x007f27d6e24f00 @rank=2, @suit=:spades>, #<Card:0x007f27d6e24f50 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6e24fa0 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6e24ff0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6e25040 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6e25090 @rank=10, @suit=:hearts>, #<Card:0x007f27d6e250e0 @rank=9, @suit=:hearts>, #<Card:0x007f27d6e25130 @rank=8, @suit=:hearts>, #<Card:0x007f27d6e25180 @rank=7, @suit=:hearts>, #<Card:0x007f27d6e251d0 @rank=6, @suit=:hearts>, #<Card:0x007f27d6e25220 @rank=5, @suit=:hearts>, #<Card:0x007f27d6e25270 @rank=4, @suit=:hearts>, #<Card:0x007f27d6e252c0 @rank=3, @suit=:hearts>, #<Card:0x007f27d6e25310 @rank=2, @suit=:hearts>, #<Card:0x007f27d6e25360 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6e253b0 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6e254a0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6e25518 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6e25590 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6e25608 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6e25680 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6e256d0 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6e25720 @rank=6, @suit=:diamonds>, #<Card:0x007f27d6e257c0 @rank=5, @suit=:diamonds>, #<Card:0x007f27d6e25810 @rank=4, @suit=:diamonds>, #<Card:0x007f27d6e25860 @rank=3, @suit=:diamonds>, #<Card:0x007f27d6e258b0 @rank=2, @suit=:diamonds>, #<Card:0x007f27d6e25900 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6e25950 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6e259a0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6e259f0 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6e25a40 @rank=10, @suit=:clubs>, #<Card:0x007f27d6e25a90 @rank=9, @suit=:clubs>, #<Card:0x007f27d6e25ae0 @rank=8, @suit=:clubs>, #<Card:0x007f27d6e25b30 @rank=7, @suit=:clubs>, #<Card:0x007f27d6e25b80 @rank=6, @suit=:clubs>, #<Card:0x007f27d6e25bf8 @rank=5, @suit=:clubs>, #<Card:0x007f27d6e25c48 @rank=4, @suit=:clubs>, #<Card:0x007f27d6e25cc0 @rank=3, @suit=:clubs>, #<Card:0x007f27d6e25d10 @rank=2, @suit=:clubs>]
       actual collection contained:    [#<Card:0x007f27d6e26738 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6e26878 @rank=:king, @suit=:spades>, #<Card:0x007f27d6e269b8 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6e26af8 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6e26c60 @rank=10, @suit=:spades>, #<Card:0x007f27d6e26dc8 @rank=9, @suit=:spades>, #<Card:0x007f27d6e26f08 @rank=8, @suit=:spades>, #<Card:0x007f27d6e27070 @rank=7, @suit=:spades>, #<Card:0x007f27d6e272a0 @rank=6, @suit=:spades>, #<Card:0x007f27d6e274a8 @rank=5, @suit=:spades>, #<Card:0x007f27d6e275e8 @rank=4, @suit=:spades>, #<Card:0x007f27d6e27728 @rank=3, @suit=:spades>, #<Card:0x007f27d6e27868 @rank=2, @suit=:spades>, #<Card:0x007f27d6e26788 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6e268c8 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6e26a08 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6e26b48 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6e26cd8 @rank=10, @suit=:hearts>, #<Card:0x007f27d6e26e18 @rank=9, @suit=:hearts>, #<Card:0x007f27d6e26f58 @rank=8, @suit=:hearts>, #<Card:0x007f27d6e270c0 @rank=7, @suit=:hearts>, #<Card:0x007f27d6e27318 @rank=6, @suit=:hearts>, #<Card:0x007f27d6e274f8 @rank=5, @suit=:hearts>, #<Card:0x007f27d6e27638 @rank=4, @suit=:hearts>, #<Card:0x007f27d6e27778 @rank=3, @suit=:hearts>, #<Card:0x007f27d6e278b8 @rank=2, @suit=:hearts>, #<Card:0x007f27d6e267d8 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6e26918 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6e26a58 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6e26bc0 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6e26d28 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6e26e68 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6e26fd0 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6e27188 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6e27390 @rank=6, @suit=:diamonds>, #<Card:0x007f27d6e27548 @rank=5, @suit=:diamonds>, #<Card:0x007f27d6e27688 @rank=4, @suit=:diamonds>, #<Card:0x007f27d6e277c8 @rank=3, @suit=:diamonds>, #<Card:0x007f27d6e27908 @rank=2, @suit=:diamonds>, #<Card:0x007f27d6e26828 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6e26968 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6e26aa8 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6e26c10 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6e26d78 @rank=10, @suit=:clubs>, #<Card:0x007f27d6e26eb8 @rank=9, @suit=:clubs>, #<Card:0x007f27d6e27020 @rank=8, @suit=:clubs>, #<Card:0x007f27d6e27228 @rank=7, @suit=:clubs>, #<Card:0x007f27d6e273e0 @rank=6, @suit=:clubs>, #<Card:0x007f27d6e27598 @rank=5, @suit=:clubs>, #<Card:0x007f27d6e276d8 @rank=4, @suit=:clubs>, #<Card:0x007f27d6e27818 @rank=3, @suit=:clubs>, #<Card:0x007f27d6e27958 @rank=2, @suit=:clubs>]
       the missing elements were:      [#<Card:0x007f27d6e24b40 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6e24b90 @rank=:king, @suit=:spades>, #<Card:0x007f27d6e24be0 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6e24c30 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6e24c80 @rank=10, @suit=:spades>, #<Card:0x007f27d6e24cd0 @rank=9, @suit=:spades>, #<Card:0x007f27d6e24d20 @rank=8, @suit=:spades>, #<Card:0x007f27d6e24d70 @rank=7, @suit=:spades>, #<Card:0x007f27d6e24dc0 @rank=6, @suit=:spades>, #<Card:0x007f27d6e24e10 @rank=5, @suit=:spades>, #<Card:0x007f27d6e24e60 @rank=4, @suit=:spades>, #<Card:0x007f27d6e24eb0 @rank=3, @suit=:spades>, #<Card:0x007f27d6e24f00 @rank=2, @suit=:spades>, #<Card:0x007f27d6e24f50 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6e24fa0 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6e24ff0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6e25040 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6e25090 @rank=10, @suit=:hearts>, #<Card:0x007f27d6e250e0 @rank=9, @suit=:hearts>, #<Card:0x007f27d6e25130 @rank=8, @suit=:hearts>, #<Card:0x007f27d6e25180 @rank=7, @suit=:hearts>, #<Card:0x007f27d6e251d0 @rank=6, @suit=:hearts>, #<Card:0x007f27d6e25220 @rank=5, @suit=:hearts>, #<Card:0x007f27d6e25270 @rank=4, @suit=:hearts>, #<Card:0x007f27d6e252c0 @rank=3, @suit=:hearts>, #<Card:0x007f27d6e25310 @rank=2, @suit=:hearts>, #<Card:0x007f27d6e25360 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6e253b0 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6e254a0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6e25518 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6e25590 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6e25608 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6e25680 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6e256d0 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6e25720 @rank=6, @suit=:diamonds>, #<Card:0x007f27d6e257c0 @rank=5, @suit=:diamonds>, #<Card:0x007f27d6e25810 @rank=4, @suit=:diamonds>, #<Card:0x007f27d6e25860 @rank=3, @suit=:diamonds>, #<Card:0x007f27d6e258b0 @rank=2, @suit=:diamonds>, #<Card:0x007f27d6e25900 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6e25950 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6e259a0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6e259f0 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6e25a40 @rank=10, @suit=:clubs>, #<Card:0x007f27d6e25a90 @rank=9, @suit=:clubs>, #<Card:0x007f27d6e25ae0 @rank=8, @suit=:clubs>, #<Card:0x007f27d6e25b30 @rank=7, @suit=:clubs>, #<Card:0x007f27d6e25b80 @rank=6, @suit=:clubs>, #<Card:0x007f27d6e25bf8 @rank=5, @suit=:clubs>, #<Card:0x007f27d6e25c48 @rank=4, @suit=:clubs>, #<Card:0x007f27d6e25cc0 @rank=3, @suit=:clubs>, #<Card:0x007f27d6e25d10 @rank=2, @suit=:clubs>]
       the extra elements were:        [#<Card:0x007f27d6e26738 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6e26878 @rank=:king, @suit=:spades>, #<Card:0x007f27d6e269b8 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6e26af8 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6e26c60 @rank=10, @suit=:spades>, #<Card:0x007f27d6e26dc8 @rank=9, @suit=:spades>, #<Card:0x007f27d6e26f08 @rank=8, @suit=:spades>, #<Card:0x007f27d6e27070 @rank=7, @suit=:spades>, #<Card:0x007f27d6e272a0 @rank=6, @suit=:spades>, #<Card:0x007f27d6e274a8 @rank=5, @suit=:spades>, #<Card:0x007f27d6e275e8 @rank=4, @suit=:spades>, #<Card:0x007f27d6e27728 @rank=3, @suit=:spades>, #<Card:0x007f27d6e27868 @rank=2, @suit=:spades>, #<Card:0x007f27d6e26788 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6e268c8 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6e26a08 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6e26b48 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6e26cd8 @rank=10, @suit=:hearts>, #<Card:0x007f27d6e26e18 @rank=9, @suit=:hearts>, #<Card:0x007f27d6e26f58 @rank=8, @suit=:hearts>, #<Card:0x007f27d6e270c0 @rank=7, @suit=:hearts>, #<Card:0x007f27d6e27318 @rank=6, @suit=:hearts>, #<Card:0x007f27d6e274f8 @rank=5, @suit=:hearts>, #<Card:0x007f27d6e27638 @rank=4, @suit=:hearts>, #<Card:0x007f27d6e27778 @rank=3, @suit=:hearts>, #<Card:0x007f27d6e278b8 @rank=2, @suit=:hearts>, #<Card:0x007f27d6e267d8 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6e26918 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6e26a58 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6e26bc0 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6e26d28 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6e26e68 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6e26fd0 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6e27188 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6e27390 @rank=6, @suit=:diamonds>, #<Card:0x007f27d6e27548 @rank=5, @suit=:diamonds>, #<Card:0x007f27d6e27688 @rank=4, @suit=:diamonds>, #<Card:0x007f27d6e277c8 @rank=3, @suit=:diamonds>, #<Card:0x007f27d6e27908 @rank=2, @suit=:diamonds>, #<Card:0x007f27d6e26828 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6e26968 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6e26aa8 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6e26c10 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6e26d78 @rank=10, @suit=:clubs>, #<Card:0x007f27d6e26eb8 @rank=9, @suit=:clubs>, #<Card:0x007f27d6e27020 @rank=8, @suit=:clubs>, #<Card:0x007f27d6e27228 @rank=7, @suit=:clubs>, #<Card:0x007f27d6e273e0 @rank=6, @suit=:clubs>, #<Card:0x007f27d6e27598 @rank=5, @suit=:clubs>, #<Card:0x007f27d6e276d8 @rank=4, @suit=:clubs>, #<Card:0x007f27d6e27818 @rank=3, @suit=:clubs>, #<Card:0x007f27d6e27958 @rank=2, @suit=:clubs>]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:140
     # /tmp/d20151112-27349-1ukcrir/spec.rb:18:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  3) WarDeck behaves like a deck #top peeks at the top-most card
     Failure/Error: expect(small_deck.top_card).to eq ace_of_spades
       
       expected: #<Card:0x007f27d6e094f8 @rank=:ace, @suit=:spades>
            got: #<Card:0x007f27d6e094a8 @rank=9, @suit=:clubs>
       
       (compared using ==)
       
       Diff:
       @@ -1,2 +1,2 @@
       -#<Card:0x007f27d6e094f8 @rank=:ace, @suit=:spades>
       +#<Card:0x007f27d6e094a8 @rank=9, @suit=:clubs>
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:140
     # /tmp/d20151112-27349-1ukcrir/spec.rb:43:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  4) WarDeck behaves like a deck #bottom peeks at the bottom-most card
     Failure/Error: expect(small_deck.bottom_card).to eq nine_of_clubs
       
       expected: #<Card:0x007f27d6dee068 @rank=9, @suit=:clubs>
            got: #<Card:0x007f27d6dee130 @rank=:ace, @suit=:spades>
       
       (compared using ==)
       
       Diff:
       @@ -1,2 +1,2 @@
       -#<Card:0x007f27d6dee068 @rank=9, @suit=:clubs>
       +#<Card:0x007f27d6dee130 @rank=:ace, @suit=:spades>
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:140
     # /tmp/d20151112-27349-1ukcrir/spec.rb:50:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  5) BeloteDeck behaves like a deck implements Enumerable
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:10:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  6) BeloteDeck behaves like a deck fills the deck if no initialize parameters are given
     Failure/Error: expect(deck.to_a).to match_array all_available_cards
       expected collection contained:  [#<Card:0x007f27d6ce7200 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6ce5d60 @rank=:king, @suit=:spades>, #<Card:0x007f27d6ce54f0 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6ce4c08 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6ce6d28 @rank=10, @suit=:spades>, #<Card:0x007f27d6ce40a0 @rank=9, @suit=:spades>, #<Card:0x007f27d6ce41b8 @rank=8, @suit=:spades>, #<Card:0x007f27d6ce4258 @rank=7, @suit=:spades>, #<Card:0x007f27d6ce42f8 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6ce4410 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6ce44b0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6ce4550 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6ce43c0 @rank=10, @suit=:hearts>, #<Card:0x007f27d6ce47a8 @rank=9, @suit=:hearts>, #<Card:0x007f27d6ce4820 @rank=8, @suit=:hearts>, #<Card:0x007f27d6ce4870 @rank=7, @suit=:hearts>, #<Card:0x007f27d6ce4910 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6ce4a50 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6ce4b18 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6ce4c80 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6ce49b0 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6ce4d20 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6ce4d70 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6ce4e38 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6ce4fa0 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6ce5130 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6ce51d0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6ce5248 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6ce50e0 @rank=10, @suit=:clubs>, #<Card:0x007f27d6ce5338 @rank=9, @suit=:clubs>, #<Card:0x007f27d6ce5388 @rank=8, @suit=:clubs>, #<Card:0x007f27d6ce53d8 @rank=7, @suit=:clubs>]
       actual collection contained:    [#<Card:0x007f27d6ce5e78 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6ce6300 @rank=:king, @suit=:spades>, #<Card:0x007f27d6ce6468 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6ce6648 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6ce6170 @rank=10, @suit=:spades>, #<Card:0x007f27d6ce68c8 @rank=9, @suit=:spades>, #<Card:0x007f27d6ce6a80 @rank=8, @suit=:spades>, #<Card:0x007f27d6ce6c38 @rank=7, @suit=:spades>, #<Card:0x007f27d6ce5fe0 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6ce6350 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6ce64e0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6ce6760 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6ce61c0 @rank=10, @suit=:hearts>, #<Card:0x007f27d6ce6940 @rank=9, @suit=:hearts>, #<Card:0x007f27d6ce6ad0 @rank=8, @suit=:hearts>, #<Card:0x007f27d6ce6c88 @rank=7, @suit=:hearts>, #<Card:0x007f27d6ce6080 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6ce63a0 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6ce6530 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6ce67b0 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6ce6210 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6ce6990 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6ce6b98 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6ce6d00 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6ce60f8 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6ce63f0 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6ce65d0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6ce6828 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6ce6260 @rank=10, @suit=:clubs>, #<Card:0x007f27d6ce6a30 @rank=9, @suit=:clubs>, #<Card:0x007f27d6ce6be8 @rank=8, @suit=:clubs>, #<Card:0x007f27d6ce6da0 @rank=7, @suit=:clubs>]
       the missing elements were:      [#<Card:0x007f27d6ce7200 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6ce5d60 @rank=:king, @suit=:spades>, #<Card:0x007f27d6ce54f0 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6ce4c08 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6ce6d28 @rank=10, @suit=:spades>, #<Card:0x007f27d6ce40a0 @rank=9, @suit=:spades>, #<Card:0x007f27d6ce41b8 @rank=8, @suit=:spades>, #<Card:0x007f27d6ce4258 @rank=7, @suit=:spades>, #<Card:0x007f27d6ce42f8 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6ce4410 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6ce44b0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6ce4550 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6ce43c0 @rank=10, @suit=:hearts>, #<Card:0x007f27d6ce47a8 @rank=9, @suit=:hearts>, #<Card:0x007f27d6ce4820 @rank=8, @suit=:hearts>, #<Card:0x007f27d6ce4870 @rank=7, @suit=:hearts>, #<Card:0x007f27d6ce4910 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6ce4a50 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6ce4b18 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6ce4c80 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6ce49b0 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6ce4d20 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6ce4d70 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6ce4e38 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6ce4fa0 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6ce5130 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6ce51d0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6ce5248 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6ce50e0 @rank=10, @suit=:clubs>, #<Card:0x007f27d6ce5338 @rank=9, @suit=:clubs>, #<Card:0x007f27d6ce5388 @rank=8, @suit=:clubs>, #<Card:0x007f27d6ce53d8 @rank=7, @suit=:clubs>]
       the extra elements were:        [#<Card:0x007f27d6ce5e78 @rank=:ace, @suit=:spades>, #<Card:0x007f27d6ce6300 @rank=:king, @suit=:spades>, #<Card:0x007f27d6ce6468 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6ce6648 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6ce6170 @rank=10, @suit=:spades>, #<Card:0x007f27d6ce68c8 @rank=9, @suit=:spades>, #<Card:0x007f27d6ce6a80 @rank=8, @suit=:spades>, #<Card:0x007f27d6ce6c38 @rank=7, @suit=:spades>, #<Card:0x007f27d6ce5fe0 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6ce6350 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6ce64e0 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6ce6760 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6ce61c0 @rank=10, @suit=:hearts>, #<Card:0x007f27d6ce6940 @rank=9, @suit=:hearts>, #<Card:0x007f27d6ce6ad0 @rank=8, @suit=:hearts>, #<Card:0x007f27d6ce6c88 @rank=7, @suit=:hearts>, #<Card:0x007f27d6ce6080 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6ce63a0 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6ce6530 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6ce67b0 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6ce6210 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6ce6990 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6ce6b98 @rank=8, @suit=:diamonds>, #<Card:0x007f27d6ce6d00 @rank=7, @suit=:diamonds>, #<Card:0x007f27d6ce60f8 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6ce63f0 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6ce65d0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6ce6828 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6ce6260 @rank=10, @suit=:clubs>, #<Card:0x007f27d6ce6a30 @rank=9, @suit=:clubs>, #<Card:0x007f27d6ce6be8 @rank=8, @suit=:clubs>, #<Card:0x007f27d6ce6da0 @rank=7, @suit=:clubs>]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/spec.rb:18:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  7) BeloteDeck behaves like a deck #size returns the size of the deck
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:23:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  8) BeloteDeck behaves like a deck #draw_top_card pops the top-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:29:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  9) BeloteDeck behaves like a deck #draw_bottom_card pops the bottom-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:36:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  10) BeloteDeck behaves like a deck #top peeks at the top-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:43:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  11) BeloteDeck behaves like a deck #bottom peeks at the bottom-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:50:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  12) BeloteDeck behaves like a deck #to_s returns the names of the cards, each on its own line
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:191
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:68:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  13) BeloteDeck #sort sorts the cards in the defined order
     Failure/Error: deck = BeloteDeck.new(cards)
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:204:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:204:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  14) BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:221:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:221:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  15) BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:240:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:240:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  16) BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:255:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:255:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  17) BeloteDeck hand #tierce? with tierce returns true for cards with names
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:273:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:273:in `block (5 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  18) BeloteDeck hand #tierce? with tierce returns true for cards with numbers
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:288:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:288:in `block (5 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  19) BeloteDeck hand #tierce? without tierce does not confuse cards with different suits
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:305:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:305:in `block (5 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  20) BeloteDeck hand #quarte? detects four cards with increasing ranks
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:323:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:323:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  21) BeloteDeck hand #quarte? does not return true if there is no quarte
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:338:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:338:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  22) BeloteDeck hand #quint? detects five cards with increasing ranks
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:355:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:355:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  23) BeloteDeck hand #quint? does not return true if there is no quint
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:370:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:370:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  24) BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns true when there is a carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:386
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  25) BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns false when there is no carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:386
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  26) BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns true when there is a carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:390
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  27) BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns false when there is no carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:390
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  28) BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns true when there is a carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:394
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:75:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  29) BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns false when there is no carre
     Failure/Error: hand = BeloteDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1ukcrir/spec.rb:394
     # /tmp/d20151112-27349-1ukcrir/solution.rb:223:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:90:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  30) SixtySixDeck behaves like a deck implements Enumerable
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:10:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  31) SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
     Failure/Error: expect(deck.to_a).to match_array all_available_cards
       expected collection contained:  [#<Card:0x007f27d6731928 @rank=:ace, @suit=:spades>, #<Card:0x007f27d67323a0 @rank=:king, @suit=:spades>, #<Card:0x007f27d6732580 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6732760 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6731ec8 @rank=10, @suit=:spades>, #<Card:0x007f27d6732dc8 @rank=9, @suit=:spades>, #<Card:0x007f27d6732e68 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6733228 @rank=:king, @suit=:hearts>, #<Card:0x007f27d67332c8 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6733430 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6732ff8 @rank=10, @suit=:hearts>, #<Card:0x007f27d67334d0 @rank=9, @suit=:hearts>, #<Card:0x007f27d6733548 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6733638 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6733688 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6733700 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6733598 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6733750 @rank=9, @suit=:diamonds>, #<Card:0x007f27d67337c8 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6733890 @rank=:king, @suit=:clubs>, #<Card:0x007f27d67338e0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6733980 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6733840 @rank=10, @suit=:clubs>, #<Card:0x007f27d67400e0 @rank=9, @suit=:clubs>]
       actual collection contained:    [#<Card:0x007f27d6742bd8 @rank=:ace, @suit=:spades>, #<Card:0x007f27d67433d0 @rank=:king, @suit=:spades>, #<Card:0x007f27d67487b8 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6748da8 @rank=:jack, @suit=:spades>, #<Card:0x007f27d67430d8 @rank=10, @suit=:spades>, #<Card:0x007f27d67497f8 @rank=9, @suit=:spades>, #<Card:0x007f27d6742d68 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6743c90 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6748920 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6748ec0 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6743150 @rank=10, @suit=:hearts>, #<Card:0x007f27d6749848 @rank=9, @suit=:hearts>, #<Card:0x007f27d6742de0 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6743f60 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6748b78 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6749668 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d67431f0 @rank=10, @suit=:diamonds>, #<Card:0x007f27d67498e8 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6742f48 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d67486f0 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6748cb8 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d67497a8 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6743240 @rank=10, @suit=:clubs>, #<Card:0x007f27d6749938 @rank=9, @suit=:clubs>]
       the missing elements were:      [#<Card:0x007f27d6731928 @rank=:ace, @suit=:spades>, #<Card:0x007f27d67323a0 @rank=:king, @suit=:spades>, #<Card:0x007f27d6732580 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6732760 @rank=:jack, @suit=:spades>, #<Card:0x007f27d6731ec8 @rank=10, @suit=:spades>, #<Card:0x007f27d6732dc8 @rank=9, @suit=:spades>, #<Card:0x007f27d6732e68 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6733228 @rank=:king, @suit=:hearts>, #<Card:0x007f27d67332c8 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6733430 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6732ff8 @rank=10, @suit=:hearts>, #<Card:0x007f27d67334d0 @rank=9, @suit=:hearts>, #<Card:0x007f27d6733548 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6733638 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6733688 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6733700 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d6733598 @rank=10, @suit=:diamonds>, #<Card:0x007f27d6733750 @rank=9, @suit=:diamonds>, #<Card:0x007f27d67337c8 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d6733890 @rank=:king, @suit=:clubs>, #<Card:0x007f27d67338e0 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d6733980 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6733840 @rank=10, @suit=:clubs>, #<Card:0x007f27d67400e0 @rank=9, @suit=:clubs>]
       the extra elements were:        [#<Card:0x007f27d6742bd8 @rank=:ace, @suit=:spades>, #<Card:0x007f27d67433d0 @rank=:king, @suit=:spades>, #<Card:0x007f27d67487b8 @rank=:queen, @suit=:spades>, #<Card:0x007f27d6748da8 @rank=:jack, @suit=:spades>, #<Card:0x007f27d67430d8 @rank=10, @suit=:spades>, #<Card:0x007f27d67497f8 @rank=9, @suit=:spades>, #<Card:0x007f27d6742d68 @rank=:ace, @suit=:hearts>, #<Card:0x007f27d6743c90 @rank=:king, @suit=:hearts>, #<Card:0x007f27d6748920 @rank=:queen, @suit=:hearts>, #<Card:0x007f27d6748ec0 @rank=:jack, @suit=:hearts>, #<Card:0x007f27d6743150 @rank=10, @suit=:hearts>, #<Card:0x007f27d6749848 @rank=9, @suit=:hearts>, #<Card:0x007f27d6742de0 @rank=:ace, @suit=:diamonds>, #<Card:0x007f27d6743f60 @rank=:king, @suit=:diamonds>, #<Card:0x007f27d6748b78 @rank=:queen, @suit=:diamonds>, #<Card:0x007f27d6749668 @rank=:jack, @suit=:diamonds>, #<Card:0x007f27d67431f0 @rank=10, @suit=:diamonds>, #<Card:0x007f27d67498e8 @rank=9, @suit=:diamonds>, #<Card:0x007f27d6742f48 @rank=:ace, @suit=:clubs>, #<Card:0x007f27d67486f0 @rank=:king, @suit=:clubs>, #<Card:0x007f27d6748cb8 @rank=:queen, @suit=:clubs>, #<Card:0x007f27d67497a8 @rank=:jack, @suit=:clubs>, #<Card:0x007f27d6743240 @rank=10, @suit=:clubs>, #<Card:0x007f27d6749938 @rank=9, @suit=:clubs>]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/spec.rb:18:in `block (2 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  32) SixtySixDeck behaves like a deck #size returns the size of the deck
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:23:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  33) SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:29:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  34) SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:36:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  35) SixtySixDeck behaves like a deck #top peeks at the top-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:43:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  36) SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:50:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  37) SixtySixDeck behaves like a deck #to_s returns the names of the cards, each on its own line
     Failure/Error: let(:small_deck) { deck_class.new([ace_of_spades, nine_of_clubs]) }
     ArgumentError:
       wrong number of arguments (1 for 0)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-1ukcrir/spec.rb:400
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:68:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  38) SixtySixDeck #sort sorts the cards in the defined order
     Failure/Error: deck = SixtySixDeck.new(cards)
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:413:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:413:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  39) SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
     Failure/Error: hand = SixtySixDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:430:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:430:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  40) SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
     Failure/Error: hand = SixtySixDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:443:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:443:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

  41) SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit
     Failure/Error: hand = SixtySixDeck.new([
     ArgumentError:
       wrong number of arguments (1 for 0)
     # /tmp/d20151112-27349-1ukcrir/solution.rb:234:in `initialize'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:456:in `new'
     # /tmp/d20151112-27349-1ukcrir/spec.rb:456:in `block (4 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
     # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'

Finished in 0.05446 seconds
57 examples, 41 failures

Failed examples:

rspec /tmp/d20151112-27349-1ukcrir/spec.rb:130 # Card #== compares two cards by their rank and suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:14 # WarDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:42 # WarDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:49 # WarDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:8 # BeloteDeck behaves like a deck implements Enumerable
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:14 # BeloteDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:22 # BeloteDeck behaves like a deck #size returns the size of the deck
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:28 # BeloteDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:35 # BeloteDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:42 # BeloteDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:49 # BeloteDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:67 # BeloteDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:196 # BeloteDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:220 # BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:239 # BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:254 # BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:272 # BeloteDeck hand #tierce? with tierce returns true for cards with names
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:287 # BeloteDeck hand #tierce? with tierce returns true for cards with numbers
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:304 # BeloteDeck hand #tierce? without tierce does not confuse cards with different suits
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:322 # BeloteDeck hand #quarte? detects four cards with increasing ranks
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:337 # BeloteDeck hand #quarte? does not return true if there is no quarte
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:354 # BeloteDeck hand #quint? detects five cards with increasing ranks
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:369 # BeloteDeck hand #quint? does not return true if there is no quint
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:74 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:89 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:74 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:89 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:74 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:89 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:8 # SixtySixDeck behaves like a deck implements Enumerable
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:14 # SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:22 # SixtySixDeck behaves like a deck #size returns the size of the deck
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:28 # SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:35 # SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:42 # SixtySixDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:49 # SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:67 # SixtySixDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:405 # SixtySixDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:429 # SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:442 # SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
rspec /tmp/d20151112-27349-1ukcrir/spec.rb:455 # SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit

История (1 версия и 1 коментар)

Веселин обнови решението на 11.11.2015 14:46 (преди над 8 години)

+class Card
+ attr_reader :rank, :suit
+
+ ALL_RANKS = [2, 3, 4, 5, 6, 7, 8, 9, 10, :jack, :queen, :king, :ace]
+ BELOTE_RANKS = [7, 8, 9, :jack, :queen, :king, 10, :ace]
+ SIXTY_SIX_RANKS = [9, :jack, :queen, :king, 10, :ace]
+
+ SUITS = [:clubs, :diamonds, :hearts, :spades]
+
+ SUIT_VALUES = { :clubs => 20, :diamonds => 30, :hearts => 40, :spades => 50 }
+
+ def initialize(rank, suit)
+ @rank, @suit = rank, suit
+ end
+
+ def <=>(other)
+ [SUITS.index(other.suit), ALL_RANKS.index(other.rank)] <=>
+ [SUITS.index(@suit), ALL_RANKS.index(@rank)]
+ end
+
+ def to_s()
+ "#{@rank.to_s.capitalize} of #{@suit.to_s.capitalize}"
+ end
+
+ def suite_index()
+ SUITS.index(@suit)
+ end
+
+ def belote_rank()
+ BELOTE_RANKS.index(@rank)
+ end
+
+ def same_suit(others)
+ others.any? { |other| suite_index == other.suite_index }
+ end
+
+ def index()
+ ALL_RANKS.index(@rank) + 2 + SUIT_VALUES[@suit]
+ end
+end
+
+class Hand
+
+ def initialize(cards)
+ @cards = cards
+ end
+
+ def size()
+ @cards.size
+ end
+
+ def play_card()
+ @cards.pop
+ end
+
+ def allow_face_up?()
+ @cards.size <= 3
+ end
+
+ def highest_of_suit(suit)
+ if (@cards.any? { |card| card.suit == suit} )
+ suits = @cards.select { |card| card.suit == suit }
+ return suits.sort.first
+ end
+ end
+
+ def belote?()
+ kings = @cards.select do |card|
+ card.belote_rank == Card::BELOTE_RANKS.index(:king)
+ end
+ queens = @cards.select do |card|
+ card.belote_rank == Card::BELOTE_RANKS.index(:queen)
+ end
+
+ kings.select { |king| king.same_suit(queens) }.length > 0
+ end
+
+ def check(cards, count)
+ if (cards.size < count)
+ return false
+ end
+ if (cards[0] + count - 1 == cards[count - 1])
+ return true
+ end
+ return check(cards.take(cards.length - 1).to_a, count)
+ end
+
+ def tierce?()
+ cards = @cards.dup
+ check(cards.sort.reverse.map(&:index).to_a, 3)
+ end
+
+ def quarte?()
+ cards = @cards.dup
+ check(cards.sort.reverse.map(&:index).to_a, 4)
+ end
+
+ def quint?()
+ cards = @cards.dup
+ check(cards.sort.reverse.map(&:index).to_a, 5)
+ end
+
+ def four_of_a_kind?(rank)
+ dummy_card = Card.new(rank, :spades)
+ fours = @cards.select do |card|
+ card.belote_rank == dummy_card.belote_rank
+ end
+ fours != nil ? fours.size == 4 : false
+ end
+
+ def carre_of_jacks?()
+ four_of_a_kind?(:jack)
+ end
+
+ def carre_of_nines?()
+ four_of_a_kind?(9)
+ end
+
+ def carre_of_aces?()
+ four_of_a_kind?(:ace)
+ end
+
+ def twenty?(trump_suit)
+ no = @cards.select{ |card| card != trump_suit }
+ king_card = Card.new(:king, :spades)
+ queen_card = Card.new(:queen, :spades)
+ kings = no.select { |card| card.belote_rank == king_card.belote_rank}
+ queens = no.select { |card| card.belote_rank == queen_card.belote_rank}
+
+ kings.any? { |king| king.same_suit(queens) }
+ end
+
+ def forty?(trump_suit)
+ trump = @cards.select { |card| card.suit == trump_suit }
+ king_card = Card.new(:king, :spades)
+ queen_card = Card.new(:queen, :spades)
+ kings = trump.select { |card| card.belote_rank == king_card.belote_rank }
+ queens = trump.select { |card| card.belote_rank == queen_card.belote_rank }
+
+ kings.any? { |king| king.same_suit(queens) }
+ end
+end
+
+class Deck
+ include Enumerable
+
+ alias_method :top_card, :first
+
+ def initialize(cards = nil)
+ @cards = (cards || generate_all_cards)
+ end
+
+ def each(&block)
+ @cards.map do |card|
+ yield card
+ end
+ end
+
+ def size()
+ @cards.size
+ end
+
+ def draw_top_card()
+ @cards.shift
+ end
+
+ def draw_bottom_card()
+ @cards.pop
+ end
+
+ def top_card()
+ @cards.last
+ end
+
+ def bottom_card()
+ @cards.first
+ end
+
+ def shuffle()
+ @cards = @cards.shuffle
+ end
+
+ def sort()
+ @cards = @cards.sort
+ end
+
+ def to_s()
+ @cards.map(&:to_s).join("\n")
+ end
+
+ def deal(number)
+ Hand.new(@cards.pop(number))
+ end
+
+ private
+
+ def generate_all_cards
+ Card::ALL_RANKS.product(Card::SUITS).map { |card| Card.new(*card) }.shuffle
+ end
+
+ def generate_belote_cards
+ Card::BELOTE_RANKS.product(Card::SUITS).map do |card|
+ Card.new(*card)
+ end.shuffle
+ end
+
+ def generate_sixty_six_cards
+ Card::SIXTY_SIX_RANKS.product(Card::SUITS).map do |card|
+ Card.new(*card)
+ end.shuffle
+ end
+end
+
+class WarDeck < Deck
+
+ def deal
+ super(26)
+ end
+end
+
+class BeloteDeck < Deck
+
+ def initialize()
+ super(generate_belote_cards)
+ end
+
+ def deal
+ super(8)
+ end
+end
+
+class SixtySixDeck < Deck
+
+ def initialize()
+ super(generate_sixty_six_cards)
+ end
+
+ def deal
+ super(6)
+ end
+end