Poker-AI.org
http://poker-ai.org/phpbb/

Still some bugs in my riversolver
http://poker-ai.org/phpbb/viewtopic.php?f=24&t=2486
Page 1 of 1

Author:  HontoNiBaka [ Wed May 08, 2013 3:36 am ]
Post subject:  Still some bugs in my riversolver

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.

Author:  somehomelessguy [ Wed May 08, 2013 3:58 am ]
Post subject:  Re: Still some bugs in my riversolver

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.

Author:  HontoNiBaka [ Wed May 08, 2013 4:51 am ]
Post subject:  Re: Still some bugs in my riversolver

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

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/