acpc_dealer 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22f7eec13aa813b442c16584169492fc05f0de90
4
- data.tar.gz: 90bdd31f03f7136dbb5b8249a1c910b9bde112ac
3
+ metadata.gz: 78ed614e19d26963f88c9fd399ff6a8f877f3fef
4
+ data.tar.gz: aa460540fa0fc27e2df007b3f18087e372d3faf5
5
5
  SHA512:
6
- metadata.gz: 8e45011051f0a05905273f1ebe342d783431fde57bb412032f893a7ac475e4182685d5b57aac9067d1aa85db31931b5bd37bb403641f50284f06af95184ce9db
7
- data.tar.gz: fccf0a2cb8757086c334b7093752aaf4eca73da134bd1c3772e5428e785390a4eb7638214a2e74e8fc7bc88551fd76b65e0b99175f779fda0ab4f0d0eab8db16
6
+ metadata.gz: dba4619111a26f5489f302a47a6006afbb293cb12f718d12a79fcbbe51f66a13dd40e2fe39df40ec4816da99a4a7254d23ee50686f1d4ecffa2d50491b6c2734
7
+ data.tar.gz: c4214f79d46b692e5fae27dcce538066da69e0681f729fadeb5a51039e89d12821bf337ed6ca7b55b6daade5ef294e255803a2f2540200e7b99152d502197568
@@ -10,17 +10,17 @@ class DealerRunner
10
10
  # => (see ::start)
11
11
  DEALER_COMMAND_FORMAT = [
12
12
  # @note The name of the match to start.
13
- :match_name,
13
+ :match_name,
14
14
  # @note The path of the game definition to use.
15
- :game_def_file_name,
15
+ :game_def_file_name,
16
16
  # @note The number of hands to play.
17
17
  :hands,
18
18
  # @note The random seed to use.
19
- :random_seed,
19
+ :random_seed,
20
20
  # @note The names of the players in the game. Should be specified as a space delimited string of names.
21
21
  :player_names,
22
22
  # @note Should be specified as an option string that the dealer will understand.
23
- :options
23
+ :options
24
24
  ]
25
25
 
26
26
  # @param [Array] dealer_arguments Arguments to the new dealer instance.
@@ -28,27 +28,27 @@ class DealerRunner
28
28
  # => Defaults to +<dealer_arguments[:match_name]>.logs+.
29
29
  # @param [Array] port_numbers The port numbers to which each player will connect.
30
30
  # => Defaults to random.
31
- # @return [Hash] The process ID of the started dealer (key +:pid+) and the array of ports that players may
31
+ # @return [Hash] The process ID of the started dealer (key +:pid+) and the array of ports that players may
32
32
  # => use to connect to the new dealer instance (key +:port_numbers+).
33
33
  # @raise (see ProcessRunner::go)
34
34
  # @raise (see FileUtils::mkdir_p)
35
35
  def self.start(dealer_arguments, log_directory=nil, port_numbers=nil)
36
36
  dealer_start_command = DEALER_COMMAND_FORMAT.inject([AcpcDealer::DEALER_PATH]) do |command, parameter|
37
37
  command << dealer_arguments[parameter].to_s
38
- end
38
+ end
39
39
  dealer_start_command << "-p #{port_numbers.join(',')}" if port_numbers
40
40
 
41
41
  unless log_directory
42
42
  log_directory = File.expand_path("../#{dealer_arguments[:match_name]}.logs", __FILE__)
43
43
  end
44
44
 
45
- FileUtils.mkdir_p log_directory
45
+ FileUtils.mkdir_p log_directory unless Dir.exist?(log_directory)
46
46
 
47
47
  IO.pipe do |read_io, write_io|
48
48
  pid = ProcessRunner.go(
49
- dealer_start_command,
49
+ dealer_start_command,
50
50
  err: [
51
- "#{dealer_arguments[:match_name]}.actions.log",
51
+ File.join(log_directory, "#{dealer_arguments[:match_name]}.actions.log"),
52
52
  File::CREAT|File::WRONLY
53
53
  ],
54
54
  out: write_io,
@@ -1,3 +1,3 @@
1
1
  module AcpcDealer
2
- VERSION = "0.0.3"
3
- end
2
+ VERSION = "0.0.5"
3
+ end
Binary file
@@ -127,7 +127,7 @@ static void initErrorInfo( const uint32_t maxInvalidActions,
127
127
  info->usedMatchMicros[ s ] = 0;
128
128
  }
129
129
  }
130
-
130
+
131
131
 
132
132
  /* update the number of invalid actions for seat
133
133
  returns >= 0 if match should continue, -1 for failure */
@@ -704,8 +704,8 @@ static int printFinalMessage( const Game *game, char *seatName[ MAX_PLAYERS ],
704
704
 
705
705
  actions are read/sent to seat p on seatFD[ p ]
706
706
 
707
- if quiet is not zero, only print out errors, warnings, and final value
708
-
707
+ if quiet is not zero, only print out errors, warnings, and final value
708
+
709
709
  if logFile is not NULL, print out a single line for each completed
710
710
  match with the final state and all player values. The values are
711
711
  printed in player, not seat order.
@@ -1186,7 +1186,7 @@ int main( int argc, char **argv )
1186
1186
  fprintf( stderr, "ERROR: could not open transaction file %s\n", name );
1187
1187
  exit( EXIT_FAILURE );
1188
1188
  }
1189
- } else {
1189
+ } else {
1190
1190
  /* no transaction file */
1191
1191
 
1192
1192
  transactionFile = NULL;
@@ -1275,8 +1275,12 @@ int main( int argc, char **argv )
1275
1275
  exit( EXIT_FAILURE );
1276
1276
  }
1277
1277
 
1278
- fflush( stderr );
1279
- fflush( stdout );
1278
+ //fflush( stderr );
1279
+ //fflush( stdout );
1280
+ // Otherwise the last line or two of the log file
1281
+ // won't be written sometimes when run through a
1282
+ // Ruby interface.
1283
+ fflush(NULL);
1280
1284
  if( transactionFile != NULL ) {
1281
1285
  fclose( transactionFile );
1282
1286
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_dealer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clive