Sha256: c820ececb6a9e12c2ada2381b0479d7bf4d9f7c197daa4676082c44905dea3cc

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require File.expand_path('../communication_logic/acpc_dealer_communicator', __FILE__)
require File.expand_path('../communication_logic/acpc_dealer_information', __FILE__)
require File.expand_path('../communication_logic/action_sender', __FILE__)
require File.expand_path('../communication_logic/match_state_receiver', __FILE__)

# A bot that connects to a dealer as a proxy.
class BasicProxy
  exceptions :initial_match_state_not_yet_received

  # @param [AcpcDealerInformation] dealer_information Information about the dealer to which this bot should connect.
  def initialize(dealer_information)
    @dealer_communicator = AcpcDealerCommunicator.new dealer_information.port_number, dealer_information.host_name, dealer_information.millisecond_response_timeout
  end

  # @param [PokerAction] action The action to be sent.
  # @return (see ActionSender#send_action)
  # @raise InitialMatchStateNotYetReceived
  # @raise (see ActionSender#send_action)
  def send_action(action)
    raise InitialMatchStateNotYetReceived unless @match_state
    ActionSender.send_action @dealer_communicator, @match_state, action
  end

  # @see MatchStateReceiver#receive_match_state
  def receive_match_state!
    @match_state = MatchStateReceiver.receive_match_state @dealer_communicator
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acpc_poker_basic_proxy-0.0.3 lib/acpc_poker_basic_proxy/basic_proxy.rb
acpc_poker_basic_proxy-0.0.2 lib/acpc_poker_basic_proxy/basic_proxy.rb
acpc_poker_basic_proxy-0.0.1 lib/acpc_poker_basic_proxy/basic_proxy.rb