Image Image Image




Post new topic Reply to topic  [ 91 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Open Meerkat Bot Simulation Testbed
PostPosted: Sat May 01, 2010 8:10 pm 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
Today I'm ready to announce a new developed testbed for simulating poker games for bots written against the Meerkat-API.

You can find the project at Google Code:
http://code.google.com/p/opentestbed/wiki/Features
Currently you need to check it out to Eclipse IDE.

This testbed offers some nice features not available in the SnG-Testbed (http://pokerai.org/pf3/viewtopic.php?f=3&t=2498) from this forum:
  • its open source - so everyone can contribute and implement missing features
  • it supports cash-games
  • it supports hand-history export in FTP-format, so one can easily analyse all games with PokerTracker or HoldemManager
  • you get a bankroll graph while the game is running, this graph is also exported to png at the end of the simulation
  • progress-bar so you'll know when the simulation will be finished
  • games can be replayed with the same cards but permuted seat-orders of all involved bots. Thus you can reduce variance quite well (see this thread for more information: http://pokerai.org/pf3/viewtopic.php?f=3&t=327).
  • it comes with two DemoBots (AllwaysCall and 'SimpleBot'), and one really cool sophisticated Monte-Carlo-Tree-Search one ... yes the one from Guy's thesis (http://pokerai.org/pf3/viewtopic.php?f=64&t=2664)
  • a better implementation of the Meerkat-API (for instance side-pot-handling, getEligiblePot, getAmountInPot capped to the players bankroll, all GameObserverEvents like in PokerAcademy, returned bets not fired as 'WinEvent' and much much more subtle but important things)

Actually the only thing missing is Tournaments ... but there has to be a reason for the SnG-Testbed mentioned above :D

I hope you'll find this as useful as I do - I'm still searching for contributors willing to port other open-sourced bots to Java and the Meerkat API (see viewtopic.php?f=3&t=3260).
The more DemoBots there are, the better simulations and improvements of personal bots are possible.

Have fun !


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Sat May 01, 2010 8:35 pm 
Offline
Senior member
User avatar

Posts: 138
Favourite Bot: Custom
Thank you for releasing this I will take a look


Top
 Profile  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Mon May 03, 2010 11:14 am 
Offline
Senior member
User avatar

Posts: 451
Favourite Bot: gimmick
Given that the tool already support FT hand history, is it possible, by means of configuration or minor programming, to set up things in a way that PT automatically import hands from the simulation and believes the simulation is actual FT play?

I think that saving played hands as they are played in a given directory in the same way FT does and telling PT to automatically look there should be enough, but i'm not sure.

I want this way because my bot will soon fully use PT stats to do opponent modeling and thus need PT database to be updated (possibly) after every hand to work properly.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Mon May 03, 2010 5:02 pm 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
Ockham wrote:
Given that the tool already support FT hand history, is it possible, by means of configuration or minor programming, to set up things in a way that PT automatically import hands from the simulation and believes the simulation is actual FT play?

I don't have PT at hand (and the evaluation ran out).
Actually the History is flushed after each hand - so maybe you just need to change the filename ?

I'd start with the following line in the CashGameConsoleStarter ....
Code:
handHistoryWriter.setWriter(new FileWriter("./data/" + simulationFileName + "-history.txt"))


If that doesn't work, one had to try to open/close the stream after each hand. That'd be a simple hack in the HandHistoryWriter-class.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Mon May 03, 2010 7:20 pm 
Offline
Senior member
User avatar

Posts: 451
Favourite Bot: gimmick
bluegaspode wrote:
Ockham wrote:
Given that the tool already support FT hand history, is it possible, by means of configuration or minor programming, to set up things in a way that PT automatically import hands from the simulation and believes the simulation is actual FT play?

I don't have PT at hand (and the evaluation ran out).
Actually the History is flushed after each hand - so maybe you just need to change the filename ?

I'd start with the following line in the CashGameConsoleStarter ....
Code:
handHistoryWriter.setWriter(new FileWriter("./data/" + simulationFileName + "-history.txt"))


If that doesn't work, one had to try to open/close the stream after each hand. That'd be a simple hack in the HandHistoryWriter-class.


Yes, i suspect that until the file is actually saved FT won't look for hands to be imported, thus flushing won't be enough.
But closing and reopening the stream should work, it may slow down a bit, but i don't care.

I think i can handle this myself using your given direction. I won't do this right now as i have other stuff on hands but you will hear me if i need more help.

I mostly don't use testbeds as i prefere testing on lowest limits (i think it is more reliable, i even dropped Poker Academy testing after a while) and i just have my main bot and doesn't make much sense to let it play against himself. But this seems a nice framework and i will take a look at it. Thank you.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Wed May 05, 2010 7:20 pm 
Offline
Level1 member
User avatar

Posts: 42
Favourite Bot: ZZ'
Is it possible to to put the compressed source distribution. I don't use mercurial versioning tools... Nice work and thank you for sharing.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Wed May 05, 2010 7:24 pm 
Offline
Senior member
User avatar

Posts: 451
Favourite Bot: gimmick
Install it.
It's free and its 5 minutes for the whole operation.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Wed May 05, 2010 7:41 pm 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
z.z. wrote:
Is it possible to to put the compressed source distribution. I don't use mercurial versioning tools... Nice work and thank you for sharing.


How would I get back your contributions if you don't even install Mercurial :D ?

Anyway - I'll be doing it maybe when home again (currently at a conference with too bad WLAN) ...


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Wed May 05, 2010 7:46 pm 
Offline
PokerAI fellow
User avatar

Posts: 2342
Favourite Bot: My next one
Great stuff, congrats on that. I'll check it out later.

We'll have a discution to see if we can do something to help you with tournaments.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Wed May 05, 2010 10:51 pm 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
Cool - I'd really appreciate it ...
When you checked it out (and liked it) have a look at the 'CashGameRunner'-class - and just think of adding code for blind-management and re-sitting in all players when one tournament is over.

Some things to consider: Deck-Managagement needs to be improved - if you reorder seats each Tournament needs to start with the same hands as before.
Currently a SerializedDeck just iterates all hands - but if you permute seats, the first tournament could last a different count of hands and the second tournament would start at a different position in a SerializedDeck.
So I guess one had to 'reserve' a certain count of hands for each Tournament to guarantee the same hands for replayed Tournaments. (The max size of hands to be reserved might be calculated from the blind-structure).

Or one just decides that permuting seats and replaying with same card doesn't make sense in Tournaments as just one decisition (busted/not busted) of a single bot could have so huge effects on the outcome.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Sun May 09, 2010 1:13 am 
Offline
Senior member
User avatar

Posts: 138
Favourite Bot: Custom
Running the same tornement for the same seats could be quite difficult to implement as players would go out at different times.

Would it not be better to calculate the poker tracker stats you are going to use yourself and store them locally. I know there can be quite a number of stats but this would speed up the simulation. This is how I am going to look at implementing pokertracker. Preload the currect stats when the table starts from PT and then update the stats myself.


Top
 Profile  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Sun May 09, 2010 8:02 am 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
bob101 wrote:
Running the same tornement for the same seats could be quite difficult to implement as players would go out at different times.

Yeah - this is right, still I think it would be 'fairer' in a simulation.
Anytime early in a game where AA crushes into KK (with KK winning) I'd expect two bots go all in, with one being in a very good position afterwards. Also many tournament bots will do a PushOrFold-Strategy in the end - so again 'lucky' cards will influence the simulation.
Unfortunately of course the time the bots will reach HeadsUp (and what cards they have then heads up) might differ from (repeated) game to game, so maybe the seat permutations don't have such a huge effect on reducing variance as they do in simulated cash-games.

Quote:
Would it not be better to calculate the poker tracker stats you are going to use yourself and store them locally.

I think you are referring to Ockhams post ?
MCTSBot for instance is building its opponent-model completely in-memory (with all important stats like VPIP, Aggr ...). Still this is not an easy part.
But going a step further - if you plan to put your bot to real-money games, it might be difficult to simulate all events to the gameengine.
For instance when scraping most people (I think) just take screenshots, when its their turn ... so they don't know (from scraping) what happened after they folded. If your bot connects to Pokertracker, you have on problem less (i.e. easily getting full stats from opponents) - though you will be much slower in simulations.

Many possibilities inbetween of course (like scanning the poker-rooms histories yourself, which will be much faster than poker-tracker - but not compatible across rooms ...).


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Thu May 27, 2010 9:49 pm 
Offline
Regular member
User avatar

Posts: 61
Favourite Bot: FlockBot!
I'm having a problem adding ChumpBot and FlockBot;
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: com/biotools/util/Randomizer
   at com.biotools.meerkat.Deck.<init>(Deck.java:22)
   at com.biotools.meerkat.HandEvaluator.handRank(HandEvaluator.java:208)
   at com.biotools.meerkat.HandEvaluator.handRank(HandEvaluator.java:181)
   at bots.demobots.FlockBot.getAction(FlockBot.java:46)


a bit of googling seems to suggest that randomizer was in meerkat api 2.0 but not 2.5.

I'm not too worried, I was just playing to get things working and was wondering where you wanted discussion for people having difficulties?


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Thu May 27, 2010 10:07 pm 
Offline
Senior member
User avatar

Posts: 172
Favourite Bot: don't know
██████ wrote:
I'm having a problem adding ChumpBot and FlockBot;
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: com/biotools/util/Randomizer
   at com.biotools.meerkat.Deck.<init>(Deck.java:22)
   at com.biotools.meerkat.HandEvaluator.handRank(HandEvaluator.java:208)
   at com.biotools.meerkat.HandEvaluator.handRank(HandEvaluator.java:181)
   at bots.demobots.FlockBot.getAction(FlockBot.java:46)


a bit of googling seems to suggest that randomizer was in meerkat api 2.0 but not 2.5.

I'm not too worried, I was just playing to get things working and was wondering where you wanted discussion for people having difficulties?

Yeah its a pity, the meerkat API is not complete.
You have two possibilities:
1) write your own Randomizer class in the appropiate package (its just a singleton extending 'java.security.Random'), just have a look into an older version of the meerkat API
2) change FlockBot to use your own handrank-evaluator. Take a look at the SimpleBot it contains such a method which does the same enumaration as the HandEvaluator-class.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Fri May 28, 2010 9:22 am 
Offline
Regular member
User avatar

Posts: 61
Favourite Bot: FlockBot!
ok, I'll might have a try - I thought it was worth mentioning since they were the two bots pointed to by the wiki.

My next step really is to try out Combot linking to a C++ bot (http://forums.poker-academy.com/viewtopic.php?p=18862 link seems to be just a blank page for last few days though), since I'm more comfortable writing C++ than java. Most examples of bots I'm finding are in java though, so maybe I'm missing an advantage somewhere.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Fri May 28, 2010 9:55 pm 
Offline
Regular member
User avatar

Posts: 77
Favourite Bot: homebrew
██████ wrote:
My next step really is to try out Combot linking to a C++ bot (http://forums.poker-academy.com/viewtopic.php?p=18862 link seems to be just a blank page for last few days though)


Is there any other link or reference for this? I'd find it really useful to have a C++ bridge.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Sat May 29, 2010 9:05 am 
Offline
Regular member
User avatar

Posts: 61
Favourite Bot: FlockBot!
I've not found it anywhere else. Since poker-academy seems to be on holiday at the moment I'll paste the code here. A mod can delete it if that's against the rules.

Code:
import java.awt.event.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import javax.swing.event.*;

import com.biotools.meerkat.*;
import com.biotools.meerkat.Action;
import com.biotools.meerkat.util.Preferences;


public class ComBot implements Player {
   private int ourSeat;       // our seat for the current hand
   private GameInfo gi;       // general game information
   private Preferences prefs; // the configuration options for this bot
   private Socket connection;
   
   
   public ComBot() { }
   
   public JPanel getSettingsPanel() {
      JPanel jp = new JPanel();
      SpinnerModel PortNumberModel =  new SpinnerNumberModel(prefs.getIntPreference("PORT_NUMBER"),
                                                         1024,       // min
                                                         65535,       // max
                                                         1);              // step
      final JSpinner PortNumber = new JSpinner(PortNumberModel);
      class PortNumberListener implements ChangeListener {
         private Preferences Prefs;
         public PortNumberListener(Preferences Prefs) { this.Prefs = prefs; };
         public void stateChanged(ChangeEvent evt) {
            prefs.setPreference("PORT_NUMBER",((Integer)((JSpinner)evt.getSource()).getModel().getValue()).intValue());
         }
      }
      PortNumber.addChangeListener(new PortNumberListener(prefs));
   
      jp.add(new JLabel("Port Number"));
      jp.add(PortNumber);
      return jp;
   }
   
   public Preferences getPreferences() { return prefs; }

   public void ComSend(String s) {
      try {
         connection.getOutputStream().write(s.getBytes());
      } catch (IOException ex) {
         ex.printStackTrace();
      }
   }

   public void init(Preferences playerPrefs) { this.prefs = playerPrefs; }

   public void gameStateChanged() {}
   
   public void gameStartEvent(GameInfo gInfo) {
      this.gi = gInfo;
      try {
          connection = new Socket("127.0.0.1",prefs.getIntPreference("PORT_NUMBER",50000));
      } catch (UnknownHostException ex) {
          ex.printStackTrace();
      } catch (IOException ex) {
          ex.printStackTrace();
      }
      String s = new String("");
      s = s.format("01;%4.2f;%d;%d;%d\n",gi.getBigBlindSize(),gi.getNumPlayers(),gi.getButtonSeat(),gi.getGameID());
      ComSend(s);
      for (int seat = 0;seat < 10; seat++) {
         if (gi.inGame(seat)) {
            s = s.format("02;%d;%s;%4.2f;\n",seat,gi.getPlayer(seat).getName(),gi.getPlayer(seat).getBankRoll());
            ComSend(s);
         }
      }
   }
   
   public void stageEvent(int stage) {
      String s = new String("");
      s = s.format("03;%d;%s;\n",stage,gi.getBoard().toString());
      ComSend(s);
   }
   
   public void actionEvent(int pos, Action act) {
      double toCall = gi.getPlayer(pos).getAmountToCall();
      double toRaise = gi.getPlayer(pos).getAmountRaiseable();
      String s = new String("");
      switch (act.getType()) {
         case Action.SMALL_BLIND :
         case Action.BIG_BLIND :
         case Action.POST_BLIND :
         case Action.POST_ANTE :
         case Action.POST_DEAD_BLIND :
         case Action.INVALID :
         case Action.FOLD :
         case Action.CHECK :
         case Action.ALLIN_PASS :
         case Action.MUCK :
         case Action.SIT_OUT :
         case Action.BET :
            s = s.format("04;%d;%d;%4.2f;\n",pos,act.getType(),act.getAmount());
            break;
         case Action.CALL :
            s = s.format("04;%d;%d;%4.2f;\n",pos,act.getType(),toCall);
            break;
         case Action.RAISE :
            s = s.format("04;%d;%d;%4.2f;\n",pos,act.getType(),toCall+toRaise);
      }
      ComSend(s);
   }
   
   public void dealHoleCardsEvent() { ComSend("05;\n"); }
   
   public void holeCards(Card c1, Card c2, int seat) {
      String s = new String("");
      s = s.format("06;%d;%s %s;\n",seat,c1.toString(),c2.toString());
      ComSend(s);
      this.ourSeat = seat;
   }
   
   public Action getAction() {
      double toCall = gi.getAmountToCall(ourSeat);
      double toRaise = gi.getPlayer(ourSeat).getAmountRaiseable();
      Action act;
      act = Action.foldAction(toCall);
     
      String s = new String("");
      s = s.format("07;%4.2f;%4.2f;\n",toCall,toRaise);
      ComSend(s);
      int Done = 0;
      s = "";
      int b = 0;
      while (Done == 0) {
         try {
            b = connection.getInputStream().read();
         } catch (IOException ex) {
            ex.printStackTrace();
         }
         switch (b) {
            case 10 : Done = 1; break;
            case 48 : s = s.concat("0"); break;
            case 49 : s = s.concat("1"); break;
            case 50 : s = s.concat("2"); break;
            case 59 : s = s.concat(";");
         }
         if (b == -1) {
            try {
               Thread.sleep(20);
            } catch (InterruptedException ex) {
               ex.printStackTrace();
            }
         }
      }
      if (s.compareTo("0;") == 0) act = Action.foldAction(gi);
      if (s.compareTo("1;") == 0) act = Action.callAction(gi);
      if (s.compareTo("2;") == 0) act = Action.betAction(gi);
      return act;
   }
   
   public void showdownEvent(int seat, Card c1, Card c2) {
      String s = new String("");
      s = s.format("08;%d;%s %s;\n",seat,c1.toString(),c2.toString());
      ComSend(s);
   }
   
   public void winEvent(int pos, double amount, String handName) {
      String s = new String("");
      s = s.format("09;%d;%4.2f;%s;\n",pos,amount,handName);
      ComSend(s);
   }
   
   public void gameOverEvent() {
      ComSend("10;\n");
      try {
         connection.close();
      } catch (IOException ex) {
         ex.printStackTrace();
      }
   }
}


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Sun May 30, 2010 9:47 pm 
Offline
Regular member
User avatar

Posts: 77
Favourite Bot: homebrew
Thanks ██████.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Fri Jun 04, 2010 11:28 am 
Offline
PokerAI fellow
User avatar

Posts: 2342
Favourite Bot: My next one
bluegaspode wrote:
Some things to consider: Deck-Managagement needs to be improved - if you reorder seats each Tournament needs to start with the same hands as before.
Currently a SerializedDeck just iterates all hands - but if you permute seats, the first tournament could last a different count of hands and the second tournament would start at a different position in a SerializedDeck.
So I guess one had to 'reserve' a certain count of hands for each Tournament to guarantee the same hands for replayed Tournaments. (The max size of hands to be reserved might be calculated from the blind-structure).

Or one just decides that permuting seats and replaying with same card doesn't make sense in Tournaments as just one decisition (busted/not busted) of a single bot could have so huge effects on the outcome.

Ok still haven't had time to look at it but let me answer this from the experience we gathered.

First, variance is a bitch. Using Serialized decks is pretty cool to see the effects in a particular situation with constant number of players (bubble spot, etc or in cash). But if you want to do it over a tournament and we're not talking HU, it basically won't work. One reason would be, player will bust at different times, and you can't just ensure cards won't go twice to the same guy in the end at some point. Instead of removing a bias, you're introducing a new one.

In the end, there's so much more to just cards to remove tournament variance, relative position of bots is quite important so we have an option to randomize seats between each tourneys. But in the end you'll still need to run large numbers of tournaments, especially if you're trying to see the impact of small improvements.


Top
 Profile E-mail  
 
 Post subject: Re: Open Meerkat Bot Simulation Testbed
PostPosted: Fri Jun 04, 2010 5:01 pm 
Offline
Senior member
User avatar

Posts: 356
Favourite Bot: OpenHoldem
supert wrote:
Thanks ██████.


We should just call him [REDACTED].


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 91 posts ]  Go to page 1, 2, 3, 4, 5  Next


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: