Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Mon Nov 13, 2023 5:39 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed May 08, 2013 3:36 am 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
I downloaded amax Code and tried to implement a riversolver without action abstraction and with the possibility to set an initial potsize.

This is my tree:

Image

Its not pretty, I programmed a treeDrawer quickly, but maybe you will see an error there. I stored the amount a player can win in the terminal nodes, not the overal potsize. I guess this should be ok, but I have been looking for a bug for hours, so I am not sure about anything anymore :?

Some code:

Code:
public class FoldNode extends Node {
   @Override
   public double[] trainVanilla(int trainPlayer, double[] p, double[] op) {
      double pValue = trainPlayer == 0 ? payOff : -payOff;
      double[] ev = new double[p.length];

      for (int i = 0; i < p.length; i++) {
         double sum = 0;

         for (int j = 0; j < op.length; j++) {
            if (!(Game.get(trainPlayer).get(i).overlaps(Game.get(trainPlayer^1).get(j))))
               sum += op[j];
         }
         ev[i] = sum * pValue;
         if(!(player==trainPlayer)){
            ev[i] = ev[i] + sum * Game.pot;
         }
      }
      return ev;
}   


Code:
public class ShowdownNode extends Node{
   public double[] trainVanilla(int trainPlayer, double[] p, double[] op) {
      
      double[] ev = new double[p.length];
      for (int i = 0; i < p.length; i++)
      {
         double sum = 0;
         double sum2 = 0;

         for (int j = 0; j < op.length; j++)
         {
            if (!(Game.get(trainPlayer).get(i).overlaps(Game.get(trainPlayer^1).get(j))))
            {
               if (Game.get(trainPlayer).get(i).getRank()
                     > Game.get(trainPlayer^1).get(j).getRank()){
                  sum += op[j];
                  sum2 += op[j];
               }
               else if (Game.get(trainPlayer).get(i).getRank()
                     < Game.get(trainPlayer^1).get(j).getRank()){
                  sum -= op[j];
               }
               else{
                  sum2 += 0.5*op[j];
               }
            }
         }
         ev[i] = sum * payOff + sum2*Game.pot;
      }
      return ev;      
   }
}


Code:
public class DecisionNode extends Node {
   @Override
   public double[] trainVanilla(int trainPlayer, double[] p, double[] op) {
      double[][] s = new double[Game.get(player).getSize()][];
      for (int i = 0; i < Game.get(player).getSize(); i++)
         s[i] = getStrategy(i);

      if (player == trainPlayer)
      {
         for (int i = 0; i < p.length; i++)
         {
            for (int j = 0; j < children.length; j++)
               cumulativeStrategy[i][j] += p[i] * s[i][j];
         }

         double[][] u = new double[children.length][];
         double[] ev = new double[p.length];

         for (int j = 0; j < children.length; j++)
         {
            double[] newp = new double[p.length];
            for (int i = 0; i < p.length; i++)
               newp[i] = s[i][j] * p[i];

            u[j] = children[j].trainVanilla(trainPlayer, newp, op);

            for (int i = 0; i < p.length; i++)
               ev[i] += u[j][i] * s[i][j];
         }
         for (int i = 0; i < p.length; i++)
         {
            for (int j = 0; j < children.length; j++){
               regret[i][j] += u[j][i] - ev[i];
            }
         }

         return ev;

      }
      else
      {
         double[] ev = new double[p.length];

         for (int j = 0; j < children.length; j++)
         {
            double[] newop = new double[op.length];
            for (int i = 0; i < op.length; i++)
               newop[i] = s[i][j] * op[i];

            double[] u = children[j].trainVanilla(trainPlayer, p, newop);

            for (int i = 0; i < p.length; i++)
               ev[i] += u[i];
         }
         return ev;
      }
   }
}


It all worked fine for Kuhn with each player posting an ante and an initial potsize of 0. It doesnt work for trees, that allow raises or for Kuhn with an initial potsize.

This is the result for Check=>Bet=>Raise on an AKQ98 board for instance.

Image

As you can see, AA calls with a probability of 90%, which of course doesn't make sense with the nuts. If you need some other informations about my code, or results I am getting, just let me know.


Top
 Profile  
 
PostPosted: Wed May 08, 2013 3:58 am 
Offline
Junior Member

Joined: Mon Apr 22, 2013 11:46 am
Posts: 34
well, what's the result for Check=>Bet=>Raise=>Raise?
if he only calls with AA (likely), we are indifferent to raise/call with AA.

seems odd with uniform distribution for everything else though. what's the result for Check=>? it seems to only bet AA.


Top
 Profile  
 
PostPosted: Wed May 08, 2013 4:51 am 
Offline
Veteran Member

Joined: Wed Mar 20, 2013 1:43 am
Posts: 267
Check:
Image
Check=>Bet=>Raise=>Raise:
Image

All 3 images so far for an initial potsize of 0.

For a potsize of 5:

Check=>Bet=>Raise=>Raise

Image

Check=>Bet=>Raise

Image

Check

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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:
Powered by phpBB® Forum Software © phpBB Group