Sha256: 6f324aa3061820a7816dd4a0b621c3550d6b2a28c8089c88c3ce6823b96a7806
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require 'dmorrill10-utils/class' require 'acpc_poker_types/pile_of_cards' # List of community board cards. class AcpcPokerTypes::BoardCards < AcpcPokerTypes::PileOfCards exceptions :too_many_board_cards attr_reader :round def initialize() @round = nil; next_round! end def next_round! @round = if @round then @round + 1 else 0 end self[@round] = AcpcPokerTypes::PileOfCards.new self end def push(new_element) self[@round].push new_element self end alias_method :<<, :push # @return [String] The string representation of these board cards. def to_s if all? { |pile_for_round| pile_for_round.empty? } '' else '/' + (map { |pile_for_round| pile_for_round.join }).join('/') end end # @see #to_s alias_method :to_str, :to_s # @return [String] The string representation of these board cards. def to_acpc if all? { |pile_for_round| pile_for_round.empty? } '' else '/' + (map do |pile_for_round| (pile_for_round.map { |card| card.to_acpc }).join end).join('/') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acpc_poker_types-2.0.0 | lib/acpc_poker_types/board_cards.rb |
acpc_poker_types-1.0.0 | lib/acpc_poker_types/board_cards.rb |