How to get started using the CPC acpc server

373 views
Skip to first unread message

Stephen Whiddett

unread,
Jan 12, 2017, 12:48:47 PM1/12/17
to Annual Computer Poker Competition
Hi guys. I'm about to head into 6 months of researching and developing a Poker bot for my MSc dissertation project. I've downloaded the acpc code from the CPC website but I'm not sure how to get started. Is anybody able to give me some instructions or advice on how to get the code up and running and send some basic commands to it, even if its just to fold every hand. I have a windows PC and intend to develop in Java. Can I run it in windows or do I need to get set up with unix/linux? Perhaps a unix emulator may work? I'm quite new to this type of thing but very willing to learn.
Thanks
Steve

Kevin Waugh

unread,
Jan 12, 2017, 1:41:40 PM1/12/17
to Stephen Whiddett, Annual Computer Poker Competition
Hi Steve,

I sent the below instructions to another interested person via e-mail, but perhaps they are worth posting more openly.  

You can use the ACPC server code on Windows, but I personally have no experience with it.  You used to need cygwin, but I've heard that Microsoft has improved their POSIX compatibility layer, so it may be possible to do it without it now.  You can also look into using a virtual machine.

If you plan on submitting your agent to the competition, it will need to run on a Linux Amazon EC2 instance, though.  One competitor this year has submitted C# code running on Mono.  It took some effort to get working, but it is running fine.

The README in the server code is a reasonable starting point.  To quickly get started, you can run the commands:

cd project_acpc_server
make dealer example_player
./play_match.pl test_match holdem.nolimit.2p.reverse_blinds.game 3000 123 example1 ./example_player.nolimit.2p.sh example2 ./example_player.nolimit.2p.sh

This should output a score and produce a number of files, of which test_match.log will contain the hand history of the match.

Many teams start from the example player source code to interface their bot with the server.  If you create your own bot, it should take two commandline arguments, the IP address and the port of the dealer to connect to.

 - Kevin

--
You received this message because you are subscribed to the Google Groups "Annual Computer Poker Competition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to computer-poker+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/computer-poker/54d4f456-f731-4534-aabb-437d90517459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Whiddett

unread,
Jan 12, 2017, 4:00:17 PM1/12/17
to Annual Computer Poker Competition, captn...@gmail.com
Hi Kevin. Thanks for your reply. I am sure this thread could be useful to others. Looking at your 'quick start' commands, it looks like this downloads the server code, changes to the directory of the extracted files and then executes a game. I have downloaded the code and extracted it all ready. So, would you suggest I try the commands, starting from make, in a windows cmd shell? Or are those unix commands that are unlikely to work in that way?
What language is the example player code written in? I guess its C seeing as it has a .c file extension. Hopefully I can find some help to get it running with a Java program.
Thanks
Steve

Stephen Whiddett

unread,
Jan 12, 2017, 4:28:45 PM1/12/17
to Annual Computer Poker Competition, captn...@gmail.com
Hi again Kevin. I tried a windows cmd prompt but the make command failed, obviously due to no compiler. So I installed cygwin including the make and gcc packages and was successful in running the make command from the cygwin terminal. However, I get an error when I try running the play_match command as follows:

./play_match.pl test_match holdem.nolimit.2p.reverse_blinds.game 3000 123 example1 ./example_player.nolimit.2p.sh example2 ./example_player.nolimit.2p.sh
-bash: ./play_match.pl: /usr/bin/perl: bad interpreter: No such file or directory

Any ideas what the problem could be?

eric.jackson

unread,
Jan 13, 2017, 12:34:36 AM1/13/17
to Annual Computer Poker Competition, captn...@gmail.com
When you install or upgrade cygwin, you probably need to select the package that includes perl.

Stephen Whiddett

unread,
Jan 13, 2017, 6:17:33 AM1/13/17
to Annual Computer Poker Competition, captn...@gmail.com
I installed the Perl module in cygwin and now the test match works fine. Thanks for the help.

Now I'd like to  figure out how to interface with a Java program. Can anybody offer any advice on how to access the dealer messages from a Java program? I'll be using Netbeans if that has any impact.

Jon Parker

unread,
Jan 13, 2017, 10:45:58 AM1/13/17
to Stephen Whiddett, Annual Computer Poker Competition
Stephen,
  I participated in the ACPC a couple years ago.  I wrote TerribleTerrance and SpewyLouie.  

  I would be willing to send you the Java code I used to communicate with the ACPC server.  The code boils down to:

-1- Open a socket to the proper IP/port
-2- Read in Message like "MATCHSTATE:0:30:cc/:9s8h|/8c8d5c"
-3- Parse the above message to obtain the state information your bot needs to act
-4- Give the state information to your bot 
-5- Wait for your bot to supply a decision/action
-6- Encode the action into a String the ACPC server expects
-7- Send your "action message" to the ACPC server over the socket.

  I'll need a couple days to dig the code up, but I promise I'll send it to you.  Expect a message sometime towards the end of the Holiday weekend (MLK day).

  Good luck,
Jon Parker

On Fri, Jan 13, 2017 at 6:17 AM, Stephen Whiddett <captn...@gmail.com> wrote:
I installed the Perl module in cygwin and now the test match works fine. Thanks for the help.

Now I'd like to  figure out how to interface with a Java program. Can anybody offer any advice on how to access the dealer messages from a Java program? I'll be using Netbeans if that has any impact.

--
You received this message because you are subscribed to the Google Groups "Annual Computer Poker Competition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to computer-poker+unsubscribe@googlegroups.com.

Stephen Whiddett

unread,
Jan 13, 2017, 12:25:22 PM1/13/17
to Annual Computer Poker Competition, captn...@gmail.com
Hi Jon. That sounds great and I look forward to hearing back from you again. When you say the code will communicate with the ACPC server, do you mean a live online server? Is it open all the time? Or can I run a local server on my PC for development and testing? I'm not yet all that good at understanding servers.
I was doing some more searching today and found this https://github.com/jmasha by Josh Davidson on github which appears to provide an acpc client and server in java. I tried running it but had a few problems. The client code seems to want to validate a key with the server but I don't know what key is required or how to run the server. The IP address in the code seems to be inactive. Also, the forms used are no longer supported in Netbeans. But it looks like it would be nice if I could get it working as it has a nice GUI with a poker table view. Have you any knowledge of this?
Thanks again
Steve

Stephen Whiddett

unread,
Jan 15, 2017, 11:33:34 AM1/15/17
to Annual Computer Poker Competition, captn...@gmail.com
I've now figured out that I can run the acpc server with a command like:

./dealer matchName holdem.nolimit.2p.reverse_blinds.game 1000 0 Alice Bob 16177 48777

My understanding is that this runs the server and it waits for connections to ports 16177 and 48777. However, the swordfish code that I got from github appears to require an IP address for the server. Can anybody tell me how to find the IP address of the server running on my PC?

Thanks
Steve



eric.jackson

unread,
Jan 15, 2017, 2:31:44 PM1/15/17
to Annual Computer Poker Competition, captn...@gmail.com
You should be able to use "localhost" or "127.0.0.1".

Stephen Whiddett

unread,
Jan 16, 2017, 9:43:35 AM1/16/17
to Annual Computer Poker Competition, captn...@gmail.com
Thanks for you reply Eric. I've figured out that using my PC's IP address allows me to make some form of communication with the acpc server when its running.
Now if I start the server with:
./dealer matchName holdem.limit.2p.reverse_blinds.game 1000 0 Alice Bob
and run swordfish (Java app) twice with the 2 ports 16177 and 48777, and for each send out the string: VERSION:2.0.0
in cygwin I then get an ERROR: could not read version string from seat 2.
Is that the correct string to be sending to the server? Any ideas what the problem could be?

Thanks
Steve

Stephen Whiddett

unread,
Jan 16, 2017, 9:50:37 AM1/16/17
to Annual Computer Poker Competition, captn...@gmail.com
Success! When running the Java program I was killing it between runs. I just tried running 2 instances and keeping them both alive which resulted in this output in cygwin:

$ ./dealer matchName holdem.limit.2p.reverse_blinds.game 1000 0 Alice Bob
16177 48777
# name/game/hands/seed matchName holdem.limit.2p.reverse_blinds.game 1000 0
#--t_response 600000
#--t_hand 600000
#--t_per_hand 7000
STARTED at 1484577946.176550
TO 1 at 1484577946.176688 MATCHSTATE:0:0::5d5c|
TO 2 at 1484577946.176755 MATCHSTATE:1:0::|9hQd
FROM 2 at 1484577946.176775
WARNING: bad state format in response

I guess that means its working to some extent, although there is a warning there. Now, how can I run the dealer with one example_player instance so that it only expects connection from one additional (my Java) player?
Thanks
Steve
Reply all
Reply to author
Forward
0 new messages