acpc_dealer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +33 -0
- data/Rakefile +20 -0
- data/acpc_dealer.gemspec +29 -0
- data/bin/acpc_dealer +168 -0
- data/ext/hand_evaluator/extconf.rb +5 -0
- data/ext/hand_evaluator/hand_evaluator.c +38 -0
- data/lib/acpc_dealer/2p.limit.h5.r0.logs/2p.limit.h5.r0.actions.log +5 -0
- data/lib/acpc_dealer/2p.limit.h5.r0.logs/2p.limit.h5.r0.log +0 -0
- data/lib/acpc_dealer/dealer_runner.rb +72 -0
- data/lib/acpc_dealer/version.rb +3 -0
- data/lib/acpc_dealer.rb +33 -0
- data/lib/hand_evaluator.so +0 -0
- data/spec/coverage/assets/0.5.3/app.js +88 -0
- data/spec/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +363 -0
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +44 -0
- data/spec/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.5.3/highlight.css +129 -0
- data/spec/coverage/assets/0.5.3/highlight.pack.js +1 -0
- data/spec/coverage/assets/0.5.3/jquery-1.6.2.min.js +18 -0
- data/spec/coverage/assets/0.5.3/jquery.dataTables.min.js +152 -0
- data/spec/coverage/assets/0.5.3/jquery.timeago.js +141 -0
- data/spec/coverage/assets/0.5.3/jquery.url.js +174 -0
- data/spec/coverage/assets/0.5.3/loading.gif +0 -0
- data/spec/coverage/assets/0.5.3/magnify.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +295 -0
- data/spec/coverage/assets/0.5.3/stylesheet.css +383 -0
- data/spec/coverage/index.html +81 -0
- data/spec/dealer_runner_spec.rb +83 -0
- data/spec/support/spec_helper.rb +33 -0
- data/vendor/project_acpc_server/LICENCE +23 -0
- data/vendor/project_acpc_server/Makefile +22 -0
- data/vendor/project_acpc_server/README +113 -0
- data/vendor/project_acpc_server/README.submission +42 -0
- data/vendor/project_acpc_server/acpc_play_match.pl +101 -0
- data/vendor/project_acpc_server/bm_server +0 -0
- data/vendor/project_acpc_server/bm_server.c +1557 -0
- data/vendor/project_acpc_server/bm_server.config +78 -0
- data/vendor/project_acpc_server/bm_widget +0 -0
- data/vendor/project_acpc_server/bm_widget.c +186 -0
- data/vendor/project_acpc_server/dealer +0 -0
- data/vendor/project_acpc_server/dealer.c +1278 -0
- data/vendor/project_acpc_server/evalHandTables +4269 -0
- data/vendor/project_acpc_server/example_player +0 -0
- data/vendor/project_acpc_server/example_player.c +204 -0
- data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -0
- data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -0
- data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -0
- data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -0
- data/vendor/project_acpc_server/game.c +1793 -0
- data/vendor/project_acpc_server/game.h +253 -0
- data/vendor/project_acpc_server/holdem.limit.2p.reverse_blinds.game +13 -0
- data/vendor/project_acpc_server/holdem.limit.3p.game +13 -0
- data/vendor/project_acpc_server/holdem.nolimit.2p.reverse_blinds.game +12 -0
- data/vendor/project_acpc_server/holdem.nolimit.3p.game +12 -0
- data/vendor/project_acpc_server/net.c +218 -0
- data/vendor/project_acpc_server/net.h +61 -0
- data/vendor/project_acpc_server/play_match.pl +99 -0
- data/vendor/project_acpc_server/protocol.odt +0 -0
- data/vendor/project_acpc_server/protocol.pdf +0 -0
- data/vendor/project_acpc_server/rng.c +138 -0
- data/vendor/project_acpc_server/rng.h +63 -0
- data/vendor/project_acpc_server/test.log +11 -0
- data/vendor/project_acpc_server/validate_submission.pl +546 -0
- metadata +315 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
This README contains information about the server code for the Annual Computer
|
2
|
+
Poker Competition. Please see the LICENCE file for information regarding the
|
3
|
+
code's licence.
|
4
|
+
|
5
|
+
===== Software Requirements =====
|
6
|
+
|
7
|
+
This code was developed and tested for use on Unix based systems. Though it
|
8
|
+
may work on other platforms, there are no guarantees.
|
9
|
+
|
10
|
+
You will need standard Unix developer tools to build the software including
|
11
|
+
gcc, and make.
|
12
|
+
|
13
|
+
===== Getting Started =====
|
14
|
+
|
15
|
+
* Building the code
|
16
|
+
|
17
|
+
The Makefile provides instructions for compiling the code. Running 'make' from
|
18
|
+
the command line will compile the required programs.
|
19
|
+
|
20
|
+
|
21
|
+
* The programs
|
22
|
+
|
23
|
+
dealer - Communicates with agents connected over sockets to play a game
|
24
|
+
example_player - A sample player implemented in C
|
25
|
+
play_match.pl - A perl script for running matches with the dealer
|
26
|
+
|
27
|
+
Usage information for each of the programs is available by running the
|
28
|
+
executable without any arguments.
|
29
|
+
|
30
|
+
|
31
|
+
* Playing a match
|
32
|
+
|
33
|
+
The fastest way to start a match is through the play_match.pl script. An
|
34
|
+
example follows:
|
35
|
+
|
36
|
+
$ ./play_match.pl matchName holdem.limit.2p.reverse_blinds.game 1000 0 Alice ./example_player.limit.2p.sh Bob ./example_player.limit.2p.sh
|
37
|
+
|
38
|
+
After play_match.pl finishes running, there will be two output files for the
|
39
|
+
dealer and two output files for each player in the game:
|
40
|
+
|
41
|
+
matchName.err - The stderr from dealer including the messages sent to players
|
42
|
+
matchName.log - The log for the hands played during the match
|
43
|
+
matchName.playerN.std - stdout from player N
|
44
|
+
matchName.playerN.err - stderr from player N
|
45
|
+
|
46
|
+
Note, play_match.pl expects player executables that take exactly two arguments:
|
47
|
+
the server IP followed by the port number. The executable must be specified
|
48
|
+
such that it is either a path or the executable name if it can be found in your
|
49
|
+
$PATH.
|
50
|
+
|
51
|
+
If you need to pass specific arguments to you agent, we suggest wrapping it in
|
52
|
+
another script. play_match.pl will pass any extra arguments to dealer.
|
53
|
+
Matches can also be started by calling dealer and starting the players
|
54
|
+
manually. More information on this is contained in the dealer section below.
|
55
|
+
|
56
|
+
|
57
|
+
* dealer
|
58
|
+
|
59
|
+
Running dealer will start a process that waits for other players to connect to
|
60
|
+
it. After starting dealer, it will output something similar to the following:
|
61
|
+
|
62
|
+
$ ./dealer matchName holdem.limit.2p.reverse_blinds.game 1000 0 Alice Bob
|
63
|
+
16177 48777
|
64
|
+
# name/game/hands/seed matchName holdem.limit.2p.reverse_blinds.game 1000 0
|
65
|
+
#--t_response 10000
|
66
|
+
#--t_hand 600000
|
67
|
+
#--t_per_hand 6000
|
68
|
+
|
69
|
+
On the first line of output there should be as many numbers as there are
|
70
|
+
players in the game (in this case, "16177" and "48777"). These are the ports
|
71
|
+
the dealer is listening on for players. Note that these ports are specific to
|
72
|
+
the positions for players in the game.
|
73
|
+
|
74
|
+
Once all the players have connected to the game, the dealer will begin playing
|
75
|
+
the game and outputting the messages sent to each player. After the end of the
|
76
|
+
match, you should have a log file called matchName.log in the directory where
|
77
|
+
dealer was started with the hands that were played.
|
78
|
+
|
79
|
+
Matches can also be started by starting the dealer and connecting the
|
80
|
+
executables by hand. This can be useful if you want to start your own program
|
81
|
+
in a way that is difficult to script (such as running it in a debugger).
|
82
|
+
|
83
|
+
|
84
|
+
==== Game Definitions ====
|
85
|
+
|
86
|
+
The dealer takes game definition files to determine which game of poker it
|
87
|
+
plays. Please see the included game definitions for some examples. The code
|
88
|
+
for handling game definitions is found in game.c and game.h.
|
89
|
+
|
90
|
+
Game definitions can have the following fields (case is ignored):
|
91
|
+
|
92
|
+
gamedef - the starting tag for a game definition
|
93
|
+
end gamedef - ending tag for a game definition
|
94
|
+
stack - the stack size for each player at the start of each hand (for no-limit)
|
95
|
+
blind - the size of the blinds for each player (relative to the dealer)
|
96
|
+
raisesize - the size of raises on each round (for limit games)
|
97
|
+
limit - specifies a limit game
|
98
|
+
nolimit - specifies a no-limit game
|
99
|
+
numplayers - number of players in the game
|
100
|
+
numrounds - number of betting rounds per hand of the game
|
101
|
+
firstplayer - the player that acts first (relative to the dealer) on each round
|
102
|
+
maxraises - the maximum number of raises on each round
|
103
|
+
numsuits - the number of different suits in the deck
|
104
|
+
numranks - the number of different ranks in the deck
|
105
|
+
numholecards - the number of private cards to deal to each player
|
106
|
+
numboardcards - the number of cards revealed on each round
|
107
|
+
|
108
|
+
Empty lines or lines with '#' as the very first character will be ignored
|
109
|
+
|
110
|
+
If you are creating your own game definitions, please note that game.h defines
|
111
|
+
some constants for maximums in games (e.g., number of rounds). These may need
|
112
|
+
to be changed for games outside of the what is being run for the Annual
|
113
|
+
Computer Poker Competition.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#############################################################
|
2
|
+
# Please fill out the following information about your team
|
3
|
+
#############################################################
|
4
|
+
|
5
|
+
Team Name:
|
6
|
+
Agent Name (can be the same as team name):
|
7
|
+
|
8
|
+
For each team member, please list the following:
|
9
|
+
Name, Team leader (y/n)?, e-mail, Academic (y/n, position - e.g., PhD student)?, University/Business affiliation, Location (city, province/state, country)
|
10
|
+
|
11
|
+
Was this submission part of an academic class project? What level of class
|
12
|
+
(undergraduate/graduate)?
|
13
|
+
|
14
|
+
|
15
|
+
###########################################################################
|
16
|
+
# Please provide as much information about your agent as possible as the
|
17
|
+
# competition organizers are very interested in knowing more about the
|
18
|
+
# techniques used by our competitors.
|
19
|
+
###########################################################################
|
20
|
+
|
21
|
+
1) Is your agent dynamic? That is, does its strategy change throughout the
|
22
|
+
course of a match, or is the strategy played the same throughout the match?
|
23
|
+
|
24
|
+
2) Does your agent use a (approximate) Nash equilibrium strategy?
|
25
|
+
|
26
|
+
3) Does your agent attempt to model your opponents? If so, does it do so
|
27
|
+
online during the competition or offline from data (e.g., using logs of play or
|
28
|
+
the benchmark server)?
|
29
|
+
|
30
|
+
4) Does your agent use techniques that would benefit from additional CPU time
|
31
|
+
during the competition?
|
32
|
+
|
33
|
+
5) Does your agent use techniques that would benefit from additional RAM during
|
34
|
+
the competition?
|
35
|
+
|
36
|
+
6) Would you agent benefit from additional disk space?
|
37
|
+
|
38
|
+
One/Two Paragraph Summary of Technique
|
39
|
+
|
40
|
+
|
41
|
+
References to relevant papers, if any
|
42
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/perl
|
2
|
+
|
3
|
+
# Copyright (C) 2011 by the Computer Poker Research Group, University of Alberta
|
4
|
+
|
5
|
+
use Socket;
|
6
|
+
use File::Basename;
|
7
|
+
|
8
|
+
$hostname = `hostname` or die "could not get hostname";
|
9
|
+
chomp $hostname;
|
10
|
+
@hostent = gethostbyname( $hostname );
|
11
|
+
$#hostent >= 4 or die "could not look up $hostname";
|
12
|
+
$hostip = inet_ntoa( $hostent[ 4 ] );
|
13
|
+
|
14
|
+
$#ARGV >= 3 or die "usage: play_match.pl matchName gameDefFile #Hands rngSeed player1name player1exe player2name player2exe ... [options]";
|
15
|
+
|
16
|
+
$numPlayers = -1;
|
17
|
+
open FILE, '<', $ARGV[ 1 ] or die "couldn't open game definition $ARGV[ 1 ]";
|
18
|
+
while( $_ = <FILE> ) {
|
19
|
+
|
20
|
+
@_ = split;
|
21
|
+
|
22
|
+
if( uc( $_[ 0 ] ) eq 'NUMPLAYERS' ) {
|
23
|
+
$numPlayers = $_[ $#_ ];
|
24
|
+
}
|
25
|
+
}
|
26
|
+
close FILE;
|
27
|
+
|
28
|
+
$numPlayers > 1 or die "couldn't get number of players from $ARGV[ 1 ]";
|
29
|
+
|
30
|
+
|
31
|
+
$#ARGV >= 3 + $numPlayers * 2 or die "too few players on command line";
|
32
|
+
|
33
|
+
pipe STDINREADPIPE, STDINWRITEPIPE or die "couldn't create stdin pipe";
|
34
|
+
pipe STDOUTREADPIPE, STDOUTWRITEPIPE or die "couldn't create stdout pipe";
|
35
|
+
|
36
|
+
$dealerPID = fork();
|
37
|
+
if( $dealerPID == 0 ) {
|
38
|
+
# we're the child
|
39
|
+
|
40
|
+
# replace standard in and standard out with pipe
|
41
|
+
close STDINWRITEPIPE;
|
42
|
+
close STDOUTREADPIPE;
|
43
|
+
open STDIN, '<&STDINREADPIPE' or die "can't dup STDIN";
|
44
|
+
open STDOUT, '>&STDOUTWRITEPIPE' or die "can't dup STDOUT";
|
45
|
+
open STDERR, ">>$ARGV[ 0 ].err" or die "can't open log file $ARGV[ 0 ].err";
|
46
|
+
|
47
|
+
@args = ( "dealer", $ARGV[ 0 ], $ARGV[ 1 ],
|
48
|
+
$ARGV[ 2 ], $ARGV[ 3 ] );
|
49
|
+
|
50
|
+
# add names to the arguments
|
51
|
+
for( $p = 0; $p < $numPlayers; ++$p ) {
|
52
|
+
push @args, $ARGV[ 4 + $p * 2 ];
|
53
|
+
}
|
54
|
+
|
55
|
+
# add any extra arguments (options?) to the arguments
|
56
|
+
for( $i = 4 + $numPlayers * 2; $i <= $#ARGV; ++$i ) {
|
57
|
+
push @args, $ARGV[ $i ];
|
58
|
+
}
|
59
|
+
exec { "./dealer" } @args or die "Couldn't run dealer";
|
60
|
+
}
|
61
|
+
|
62
|
+
close STDINREADPIPE;
|
63
|
+
close STDOUTWRITEPIPE;
|
64
|
+
|
65
|
+
$_ = <STDOUTREADPIPE> or die "couldn't read port description from dealer";
|
66
|
+
@_ = split;
|
67
|
+
$#_ + 1 >= $numPlayers or die "couldn't get enough ports from $_";
|
68
|
+
|
69
|
+
for( $p = 0; $p < $numPlayers; ++$p ) {
|
70
|
+
|
71
|
+
$playerPID[ $p ] = fork();
|
72
|
+
|
73
|
+
if( $playerPID[ $p ] == 0 ) {
|
74
|
+
# we're the child
|
75
|
+
|
76
|
+
# log standard out and standard error
|
77
|
+
open STDOUT, ">$ARGV[ 0 ].player$p.std"
|
78
|
+
or die "can't dup player $p STDOUT";
|
79
|
+
open STDERR, ">$ARGV[ 0 ].player$p.err"
|
80
|
+
or die "can't dup player $p STDERR";
|
81
|
+
|
82
|
+
($playerExec, $playerDir) = fileparse( $ARGV[ 4 + $p * 2 + 1 ] );
|
83
|
+
chdir $playerDir or die "Can't cd to $playerDir: $!\n";
|
84
|
+
exec { "./$playerExec" } ( "./$playerExec", $hostip, $_[ $p ] )
|
85
|
+
or die "couldn't run $playerExec from $playerDir for player $p";
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
$_ = <STDOUTREADPIPE>;
|
90
|
+
|
91
|
+
for( $p = 0; $p < $numPlayers; ++$p ) {
|
92
|
+
waitpid( $playerPID[ $p ], 0 );
|
93
|
+
}
|
94
|
+
|
95
|
+
waitpid( $dealerPID, 0 );
|
96
|
+
|
97
|
+
$_ or die "couldn't get values from dealer";
|
98
|
+
|
99
|
+
print $_;
|
100
|
+
|
101
|
+
exit( 0 );
|
Binary file
|