Решение на Четвърта задача от Кристиян Първанов

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

Към профила на Кристиян Първанов

Резултати

  • 0 точки от тестове
  • 0 бонус точки
  • 0 точки общо
  • 4 успешни тест(а)
  • 53 неуспешни тест(а)

Код

class Card
def initialize(rank, suit)
@rank = rank
@suit = suit
end
attr_accessor :rank, :suit
def to_s
if rank.is_a? Integer
"#{rank} of #{suit.capitalize}"
else
"#{rank.capitalize} of #{suit.capitalize}"
end
end
def ==(other)
@rank == other.rank and @suit == other.suit
end
end
class Game
attr_accessor :hand
def size
hand.size
end
def draw_top_card
hand.shift
end
def draw_bottom_card
hand.pop
end
def top_card
hand.first
end
def bottom_card
hand.last
end
def shuffle
hand.shuffle!
end
def sort
hand.sort!{|a, b| a.rank.to_s <=> b.rank.to_s}
hand.sort!{|a, b| b.suit.to_s <=> a.suit.to_s}
end
def to_s
puts hand.to_s
end
def deal
end
end
class WarDeck < Game
VALUE = %w(2 3 4 5 6 7 8 9 10 Jack Qeen King Ace)
include Enumerable
def initialize(hand)
@hand = hand
# @size = size
end
def each
end
def play_card
@hand.pop
end
def allow_face_up?
@hand.size <= 3 ? true : false
end
end
class BeloteDeck < Game
VALUE = %w(7 8 9 10 Jack Qeen King Ace)
def highest_of_suit(suit)
hand.find { |e| e.suit == :suit }
end
def belote?
end
def tierce?
end
def quarte?
end
def quint?
end
def carre_of_jacks?
hand.count { |e| e.rank == :jack } == 4 ? true : false
end
def carre_of_nines?
hand.count { |e| e.rank == 9 } == 4 ? true : false
end
def carre_of_aces?
hand.count { |e| e.rank == :ace } == 4 ? true : false
end
end
class SixtySixDeck < Game
VALUE = %w(9 10 Jack Qeen King Ace)
def initialize(cards, size: 24)
@cards = cards
@size = size
end
def twenty?(trump_suit)
end
def forty?(trump_suit)
end
end

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

...FF.FFFFF[#<Card:0x007fb292bda320 @rank=:ace, @suit=:spades>, #<Card:0x007fb292bda2f8 @rank=9, @suit=:clubs>]
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFF

Failures:

  1) WarDeck behaves like a deck implements Enumerable
     Failure/Error: expect(small_deck.to_a).to eq [ace_of_spades, nine_of_clubs]
       
       expected: [#<Card:0x007fb291d3ef50 @rank=:ace, @suit=:spades>, #<Card:0x007fb291d3ef28 @rank=9, @suit=:clubs>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,3 +1,2 @@
       -[#<Card:0x007fb291d3ef50 @rank=:ace, @suit=:spades>,
       - #<Card:0x007fb291d3ef28 @rank=9, @suit=:clubs>]
       +[]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/spec.rb:11: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)>'

  2) WarDeck behaves like a deck fills the deck if no initialize parameters are given
     Failure/Error: deck = deck_class.new
     ArgumentError:
       wrong number of arguments (0 for 1)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/solution.rb:58:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:15:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:15: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 #draw_top_card pops the top-most card
     Failure/Error: expect(small_deck.to_a).to eq [nine_of_clubs]
       
       expected: [#<Card:0x007fb292b21e38 @rank=9, @suit=:clubs>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,2 +1,2 @@
       -[#<Card:0x007fb292b21e38 @rank=9, @suit=:clubs>]
       +[]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/spec.rb:30: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 #draw_bottom_card pops the bottom-most card
     Failure/Error: expect(small_deck.to_a).to eq [ace_of_spades]
       
       expected: [#<Card:0x007fb292c02500 @rank=:ace, @suit=:spades>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,2 +1,2 @@
       -[#<Card:0x007fb292c02500 @rank=:ace, @suit=:spades>]
       +[]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/spec.rb:37: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) WarDeck behaves like a deck #top peeks at the top-most card
     Failure/Error: expect(small_deck.to_a).to eq [ace_of_spades, nine_of_clubs]
       
       expected: [#<Card:0x007fb292bc0538 @rank=:ace, @suit=:spades>, #<Card:0x007fb292bc0510 @rank=9, @suit=:clubs>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,3 +1,2 @@
       -[#<Card:0x007fb292bc0538 @rank=:ace, @suit=:spades>,
       - #<Card:0x007fb292bc0510 @rank=9, @suit=:clubs>]
       +[]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/spec.rb:44: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)>'

  6) WarDeck behaves like a deck #bottom peeks at the bottom-most card
     Failure/Error: expect(small_deck.to_a).to eq [ace_of_spades, nine_of_clubs]
       
       expected: [#<Card:0x007fb292b1b768 @rank=:ace, @suit=:spades>, #<Card:0x007fb292b1b740 @rank=9, @suit=:clubs>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,3 +1,2 @@
       -[#<Card:0x007fb292b1b768 @rank=:ace, @suit=:spades>,
       - #<Card:0x007fb292b1b740 @rank=9, @suit=:clubs>]
       +[]
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/spec.rb:51: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)>'

  7) WarDeck behaves like a deck #shuffle does not remove cards from the deck
     Failure/Error: deck = deck_class.new
     ArgumentError:
       wrong number of arguments (0 for 1)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/solution.rb:58:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:57:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:57: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) WarDeck behaves like a deck #to_s returns the names of the cards, each on its own line
     Failure/Error: expect(small_deck.to_s.strip).to eq "Ace of Spades\n9 of Clubs"
     NoMethodError:
       undefined method `strip' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:140
     # /tmp/d20151112-27349-wurxw/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)>'

  9) WarDeck #sort sorts the cards in the defined order
     Failure/Error: expect(deck.sort.to_a).to eq [jack_of_spades, ten_of_hearts, ace_of_clubs, two_of_clubs]
       
       expected: [#<Card:0x007fb292bdbab8 @rank=:jack, @suit=:spades>, #<Card:0x007fb292bdbd10 @rank=10, @suit=:hearts>, #<Card:0x007fb292bdb928 @rank=:ace, @suit=:clubs>, #<Card:0x007fb292bdbce8 @rank=2, @suit=:clubs>]
            got: []
       
       (compared using ==)
       
       Diff:
       @@ -1,5 +1,2 @@
       -[#<Card:0x007fb292bdbab8 @rank=:jack, @suit=:spades>,
       - #<Card:0x007fb292bdbd10 @rank=10, @suit=:hearts>,
       - #<Card:0x007fb292bdb928 @rank=:ace, @suit=:clubs>,
       - #<Card:0x007fb292bdbce8 @rank=2, @suit=:clubs>]
       +[]
     # /tmp/d20151112-27349-wurxw/spec.rb:155: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) WarDeck hand #deal deals 26 cards
     Failure/Error: hand = WarDeck.new.deal
     ArgumentError:
       wrong number of arguments (0 for 1)
     # /tmp/d20151112-27349-wurxw/solution.rb:58:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:162:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:162: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)>'

  11) WarDeck hand #allow_face_up? returns false if the cards are more than 3
     Failure/Error: let(:hand) { WarDeck.new.deal }
     ArgumentError:
       wrong number of arguments (0 for 1)
     # /tmp/d20151112-27349-wurxw/solution.rb:58:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:169:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:169:in `block (4 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/spec.rb:172: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)>'

  12) WarDeck hand #allow_face_up? returns true if the cards are less than or equal to 3
     Failure/Error: let(:hand) { WarDeck.new.deal }
     ArgumentError:
       wrong number of arguments (0 for 1)
     # /tmp/d20151112-27349-wurxw/solution.rb:58:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:169:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:169:in `block (4 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/spec.rb:176:in `block (5 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/spec.rb:176:in `times'
     # /tmp/d20151112-27349-wurxw/spec.rb:176: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)>'

  13) BeloteDeck behaves like a deck implements Enumerable
     Failure/Error: expect(deck_class).to include(Enumerable)
       expected BeloteDeck to include Enumerable
       Diff:
       @@ -1,2 +1,2 @@
       -[Enumerable]
       +BeloteDeck
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:9: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)>'

  14) 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
     NoMethodError:
       undefined method `to_a' for #<BeloteDeck:0x007fb292b49028>
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/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)>'

  15) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  16) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  17) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  18) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  19) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  20) BeloteDeck behaves like a deck #shuffle does not remove cards from the deck
     Failure/Error: initial_size = deck.size
     NoMethodError:
       undefined method `size' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/solution.rb:26:in `size'
     # /tmp/d20151112-27349-wurxw/spec.rb:59: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)>'

  21) 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-wurxw/spec.rb:191
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:6:in `block (2 levels) in <top (required)>'
     # /tmp/d20151112-27349-wurxw/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)>'

  22) 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-wurxw/spec.rb:204:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:204:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  23) BeloteDeck hand #deal deals 8 cards
     Failure/Error: expect(hand.size).to eq 8
     NoMethodError:
       undefined method `size' for nil:NilClass
     # /tmp/d20151112-27349-wurxw/spec.rb:215: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 #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-wurxw/spec.rb:221:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:221:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  25) 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-wurxw/spec.rb:240:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:240:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  26) 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-wurxw/spec.rb:255:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:255:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  27) 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-wurxw/spec.rb:273:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:273:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  28) 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-wurxw/spec.rb:288:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:288:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  29) 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-wurxw/spec.rb:305:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:305:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  30) 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-wurxw/spec.rb:323:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:323:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  31) 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-wurxw/spec.rb:338:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:338:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  32) 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-wurxw/spec.rb:355:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:355:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  33) 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-wurxw/spec.rb:370:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:370:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  34) 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-wurxw/spec.rb:386
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  35) 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-wurxw/spec.rb:386
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  36) 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-wurxw/spec.rb:390
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  37) 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-wurxw/spec.rb:390
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  38) 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-wurxw/spec.rb:394
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:75:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  39) 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-wurxw/spec.rb:394
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:90:in `new'
     # /tmp/d20151112-27349-wurxw/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)>'

  40) SixtySixDeck behaves like a deck implements Enumerable
     Failure/Error: expect(deck_class).to include(Enumerable)
       expected SixtySixDeck to include Enumerable
       Diff:
       @@ -1,2 +1,2 @@
       -[Enumerable]
       +SixtySixDeck
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/spec.rb:9: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)>'

  41) SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
     Failure/Error: deck = deck_class.new
     ArgumentError:
       wrong number of arguments (0 for 1)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:103:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:15:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:15: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)>'

  42) SixtySixDeck behaves like a deck #size returns the size of the deck
     Failure/Error: expect(small_deck.size).to eq 2
     NoMethodError:
       undefined method `size' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:26:in `size'
     # /tmp/d20151112-27349-wurxw/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)>'

  43) SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
     Failure/Error: expect(small_deck.draw_top_card).to eq ace_of_spades
     NoMethodError:
       undefined method `shift' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:29:in `draw_top_card'
     # /tmp/d20151112-27349-wurxw/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)>'

  44) SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
     Failure/Error: expect(small_deck.draw_bottom_card).to eq nine_of_clubs
     NoMethodError:
       undefined method `pop' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:32:in `draw_bottom_card'
     # /tmp/d20151112-27349-wurxw/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)>'

  45) SixtySixDeck behaves like a deck #top peeks at the top-most card
     Failure/Error: expect(small_deck.top_card).to eq ace_of_spades
     NoMethodError:
       undefined method `first' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:35:in `top_card'
     # /tmp/d20151112-27349-wurxw/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)>'

  46) SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
     Failure/Error: expect(small_deck.bottom_card).to eq nine_of_clubs
     NoMethodError:
       undefined method `last' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:38:in `bottom_card'
     # /tmp/d20151112-27349-wurxw/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)>'

  47) SixtySixDeck behaves like a deck #shuffle does not remove cards from the deck
     Failure/Error: deck = deck_class.new
     ArgumentError:
       wrong number of arguments (0 for 1)
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/solution.rb:103:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:57:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:57: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)>'

  48) SixtySixDeck behaves like a deck #to_s returns the names of the cards, each on its own line
     Failure/Error: expect(small_deck.to_s.strip).to eq "Ace of Spades\n9 of Clubs"
     NoMethodError:
       undefined method `strip' for nil:NilClass
     Shared Example Group: "a deck" called from /tmp/d20151112-27349-wurxw/spec.rb:400
     # /tmp/d20151112-27349-wurxw/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)>'

  49) SixtySixDeck #sort sorts the cards in the defined order
     Failure/Error: expect(deck.sort.to_a).to eq [jack_of_spades, ten_of_hearts, ace_of_clubs, two_of_clubs]
     NoMethodError:
       undefined method `sort!' for nil:NilClass
     # /tmp/d20151112-27349-wurxw/solution.rb:44:in `sort'
     # /tmp/d20151112-27349-wurxw/spec.rb:415: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)>'

  50) SixtySixDeck hand #deal deals 6 cards
     Failure/Error: hand = SixtySixDeck.new.deal
     ArgumentError:
       wrong number of arguments (0 for 1)
     # /tmp/d20151112-27349-wurxw/solution.rb:103:in `initialize'
     # /tmp/d20151112-27349-wurxw/spec.rb:422:in `new'
     # /tmp/d20151112-27349-wurxw/spec.rb:422: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)>'

  51) SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
     Failure/Error: expect(hand.twenty?(:hearts)).to be true
     NoMethodError:
       undefined method `twenty?' for nil:NilClass
     # /tmp/d20151112-27349-wurxw/spec.rb:439: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)>'

  52) SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
     Failure/Error: expect(hand.twenty?(:clubs)).to be false
     NoMethodError:
       undefined method `twenty?' for nil:NilClass
     # /tmp/d20151112-27349-wurxw/spec.rb:452: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)>'

  53) SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit
     Failure/Error: expect(hand.twenty?(:hearts)).to be false
     NoMethodError:
       undefined method `twenty?' for nil:NilClass
     # /tmp/d20151112-27349-wurxw/spec.rb:465: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.05182 seconds
57 examples, 53 failures

Failed examples:

rspec /tmp/d20151112-27349-wurxw/spec.rb:8 # WarDeck behaves like a deck implements Enumerable
rspec /tmp/d20151112-27349-wurxw/spec.rb:14 # WarDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-wurxw/spec.rb:28 # WarDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:35 # WarDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:42 # WarDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:49 # WarDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:56 # WarDeck behaves like a deck #shuffle does not remove cards from the deck
rspec /tmp/d20151112-27349-wurxw/spec.rb:67 # WarDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-wurxw/spec.rb:145 # WarDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-wurxw/spec.rb:161 # WarDeck hand #deal deals 26 cards
rspec /tmp/d20151112-27349-wurxw/spec.rb:171 # WarDeck hand #allow_face_up? returns false if the cards are more than 3
rspec /tmp/d20151112-27349-wurxw/spec.rb:175 # WarDeck hand #allow_face_up? returns true if the cards are less than or equal to 3
rspec /tmp/d20151112-27349-wurxw/spec.rb:8 # BeloteDeck behaves like a deck implements Enumerable
rspec /tmp/d20151112-27349-wurxw/spec.rb:14 # BeloteDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-wurxw/spec.rb:22 # BeloteDeck behaves like a deck #size returns the size of the deck
rspec /tmp/d20151112-27349-wurxw/spec.rb:28 # BeloteDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:35 # BeloteDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:42 # BeloteDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:49 # BeloteDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:56 # BeloteDeck behaves like a deck #shuffle does not remove cards from the deck
rspec /tmp/d20151112-27349-wurxw/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-wurxw/spec.rb:196 # BeloteDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-wurxw/spec.rb:212 # BeloteDeck hand #deal deals 8 cards
rspec /tmp/d20151112-27349-wurxw/spec.rb:220 # BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
rspec /tmp/d20151112-27349-wurxw/spec.rb:239 # BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
rspec /tmp/d20151112-27349-wurxw/spec.rb:254 # BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
rspec /tmp/d20151112-27349-wurxw/spec.rb:272 # BeloteDeck hand #tierce? with tierce returns true for cards with names
rspec /tmp/d20151112-27349-wurxw/spec.rb:287 # BeloteDeck hand #tierce? with tierce returns true for cards with numbers
rspec /tmp/d20151112-27349-wurxw/spec.rb:304 # BeloteDeck hand #tierce? without tierce does not confuse cards with different suits
rspec /tmp/d20151112-27349-wurxw/spec.rb:322 # BeloteDeck hand #quarte? detects four cards with increasing ranks
rspec /tmp/d20151112-27349-wurxw/spec.rb:337 # BeloteDeck hand #quarte? does not return true if there is no quarte
rspec /tmp/d20151112-27349-wurxw/spec.rb:354 # BeloteDeck hand #quint? detects five cards with increasing ranks
rspec /tmp/d20151112-27349-wurxw/spec.rb:369 # BeloteDeck hand #quint? does not return true if there is no quint
rspec /tmp/d20151112-27349-wurxw/spec.rb:74 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:89 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:74 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:89 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:74 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:89 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-wurxw/spec.rb:8 # SixtySixDeck behaves like a deck implements Enumerable
rspec /tmp/d20151112-27349-wurxw/spec.rb:14 # SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-wurxw/spec.rb:22 # SixtySixDeck behaves like a deck #size returns the size of the deck
rspec /tmp/d20151112-27349-wurxw/spec.rb:28 # SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:35 # SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:42 # SixtySixDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:49 # SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-wurxw/spec.rb:56 # SixtySixDeck behaves like a deck #shuffle does not remove cards from the deck
rspec /tmp/d20151112-27349-wurxw/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-wurxw/spec.rb:405 # SixtySixDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-wurxw/spec.rb:421 # SixtySixDeck hand #deal deals 6 cards
rspec /tmp/d20151112-27349-wurxw/spec.rb:429 # SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
rspec /tmp/d20151112-27349-wurxw/spec.rb:442 # SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
rspec /tmp/d20151112-27349-wurxw/spec.rb:455 # SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit

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

Кристиян обнови решението на 11.11.2015 05:51 (преди около 9 години)

+class Card
+ def initialize(rank, suit)
+ @rank = rank
+ @suit = suit
+ end
+
+ attr_accessor :rank, :suit
+
+ def to_s
+ if rank.is_a? Integer
+ "#{rank} of #{suit.capitalize}"
+ else
+ "#{rank.capitalize} of #{suit.capitalize}"
+ end
+ end
+
+ def ==(other)
+ @rank == other.rank and @suit == other.suit
+ end
+end
+
+class Game
+
+ attr_accessor :hand
+ def size
+ hand.size
+ end
+ def draw_top_card
+ hand.shift
+ end
+ def draw_bottom_card
+ hand.pop
+ end
+ def top_card
+ hand.first
+ end
+ def bottom_card
+ hand.last
+ end
+ def shuffle
+ hand.shuffle!
+ end
+ def sort
+ hand.sort!{|a, b| a.rank.to_s <=> b.rank.to_s}
+ hand.sort!{|a, b| b.suit.to_s <=> a.suit.to_s}
+ end
+ def to_s
+ puts hand.to_s
+ end
+ def deal
+
+ end
+end
+class WarDeck < Game
+ VALUE = %w(2 3 4 5 6 7 8 9 10 Jack Qeen King Ace)
+ include Enumerable
+
+ def initialize(hand)
+ @hand = hand
+ # @size = size
+ end
+ def each
+ end
+ def play_card
+ @hand.pop
+ end
+
+ def allow_face_up?
+ @hand.size <= 3 ? true : false
+ end
+end
+
+class BeloteDeck < Game
+ VALUE = %w(7 8 9 10 Jack Qeen King Ace)
+ def highest_of_suit(suit)
+ hand.find { |e| e.suit == :suit }
+ end
+ def belote?
+
+ end
+ def tierce?
+
+ end
+ def quarte?
+
+ end
+ def quint?
+
+ end
+ def carre_of_jacks?
+ hand.count { |e| e.rank == :jack } == 4 ? true : false
+ end
+ def carre_of_nines?
+ hand.count { |e| e.rank == 9 } == 4 ? true : false
+ end
+ def carre_of_aces?
+ hand.count { |e| e.rank == :ace } == 4 ? true : false
+ end
+end
+
+class SixtySixDeck < Game
+VALUE = %w(9 10 Jack Qeen King Ace)
+ def initialize(cards, size: 24)
+ @cards = cards
+ @size = size
+ end
+ def twenty?(trump_suit)
+
+ end
+ def forty?(trump_suit)
+
+ end
+end