Sha256: 401b71f9de3acbeb39ca08ba326782ed2b35fbd142b7e9b4d0f9d9f8adf62f50

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'acpc_dealer'
require 'acpc_poker_player_proxy'

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do |port, seat, game_definition, player_names, number_of_hands, host|
    proxy = AcpcPokerPlayerProxy::PlayerProxy.new(
      AcpcDealer::ConnectionInformation.new(port, host),
      seat.to_i - 1,
      game_definition,
      player_names[1..-2],
      number_of_hands.to_i
    ) do |patt|
      p patt.transition.next_state.to_s
    end

    while !proxy.players_at_the_table.match_ended? do
      print 'Your turn to act: '; STDOUT.flush
      action = AcpcPokerTypes::PokerAction.new(STDIN.gets.chomp)
      proxy.play! action do |patt|
        p patt.transition.next_state.to_s
      end
    end
  end

  # Declare command-line interface
  description "Command line interface to play in ACPC Dealer hosted poker matches."

  arg :port
  arg :seat
  arg :game_definition
  arg :player_names, :optional
  arg :number_of_hands, :optional
  arg :host, :optional

  version AcpcPokerPlayerProxy::VERSION

  use_log_level_option

  go!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acpc_poker_player_proxy-1.1.0 bin/acpc_poker_player_proxy