Sha256: 4765fbaf8a1c05a856fd1ad5c66793e749bb749cc65c240a3e0efd22b84d0a30
Contents?: true
Size: 1.33 KB
Versions: 20
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'acpc_dealer' require 'acpc_poker_types/game_definition' 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| game_def = AcpcPokerTypes::GameDefinition.parse_file(game_definition) player_names ||= '"' << game_def.number_of_players.times.map do |i| "p#{i}" end.join(' ') << '"' 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
20 entries across 20 versions & 1 rubygems