Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing a Poker bot
02-26-2015, 10:00 PM
Post: #1
Writing a Poker bot
Bots are written in Java using the provided Meerkat API. Check out the opentestbed project on Google Code. In there, you can find some bot examples. For example, here is the source for the ubiquitous AlwaysCallsBot.

To use a bot, you compile the source file into a Java source file. For example, if you had a bot in MyBot.java, the following line would build the class as required for inclusion in Poker Genius. (And, assume that I was not following the standard Java practice of using com.x.y package nesting. MyBot is in the root package.)

Code:
javac MyBot.java -cp meerkat-api.jar

Then, given the class file, you need to package it into a jar. Again, given MyBot.class execute:

Code:
jar cvf MyBot.jar MyBot.class

At this point, the code has been compiled and packaged but Poker Genius also requires a .pd file. (I think that is an initialism for “Player Definition”.)
You can look through the already present player definition files that are included with Poker Genius.

On OSX, they exist in the directory:
Code:
/Applications/pokergenius.app/Contents/Resources/Java/data/bots/

On Windows:
Code:
C:\Users\YOURUSERNAME\AppData\Roaming\PokerGenius\logs\players

Externally written poker bots are actually plugins, and they have a different class loader. This is specified in the PD file. Continuing the MyBot.java example, here is the relevant MyBot.pd file.

Code:
# All plug-ins must run through the following class:
PLAYER_CLASS=PlugInOpponent

# put your bot's full class name here:
BOT_PLAYER_CLASS=MyBot

# put the path to your jar file here (relative to the base, I think)
PLAYER_JAR_FILE=data/bots/MyBot.jar

# Your Bot's name:
PLAYER_NAME=MyBot

# Your bot engine name:
AI_NAME=MyBot

# Options for your Bot:
NO_LIMIT=true

Now, the both MyBot.pd and MyBod.jar need to be copied to:
Code:
- for Windows 7/ Windows 8 (32-bit): C:\Program Files\PokerGenius\data\bots\

- for Windows 7/ Windows 8 (64-bit): C:\Program Files (x86)\PokerGenius\data\bots\

- for Mac OS X: copy these files inside the application bundle into Contents\Resources\Java\data\bots\

Now, start Poker Genius, and click “Ring Games” under “Play Games”. Then, navigate to the “Opponent Manager” under:

Code:
Window » Opponent Manager

Click the import botton, and find your PD file. I think it was meant to work automatially, but it has been flaky in my experience, so I just start from here. Import your bot, then restart the Poker Genius. Go to “Ring Games” again, and go to the “Full Ring Mixed” game in the “No Limit” section. There will be 10 seats with the types of players to be seated on the right hand side. Click one, and a menu will pop up. Click MyBot. Then, click “Load Table”. Your bot should now be playing poker.
Find all posts by this user
Quote this message in a reply
05-08-2017, 10:57 PM (This post was last modified: 05-10-2017 04:47 PM by Gabriel Depuy.)
Post: #2
RE: Writing a Poker bot
Awesome article! As easy as pie with .pd file. I've read jenu infuser review here, it helped me make up my mind.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)