Open Source ICM Calculator gesucht

  • 1 Antwort
    • DeathDraw
      DeathDraw
      Bronze
      Dabei seit: 12.01.2007 Beiträge: 1.544
      code:
      
         /** 
          * \param payouts Payout structure, e.g.: new double[]{0.5,0.3,0.2} 
          * \param stacks Player stacks 
          * \param player Index of selected player in the stack-array 
          * \returns ICM equity for selected player 
          */ 
         public static  double  getEquity ( double []  payouts,  double []  stacks,  int  player )  
         { 
           double  total =  0 ; 
           for  ( int  i =  0 ; i < stacks.length; i++ ) 
             total += stacks [ i ] ; 
           return  getEquity ( payouts, stacks.clone () , total, player,  0 ) ; 
         } 
      
         //Recursive method doing the actual calculation. 
         private static  double  getEquity ( double []  payouts,  double []  stacks,  double  total,  int  player,  int  depth )  
         { 
           double  eq = stacks [ player ]  / total * payouts [ depth ] ; 
      
           if ( depth +  1  < payouts.length ) 
             for  ( int  i =  0 ; i < stacks.length; i++ )  
               if  ( i != player && stacks [ i ]  >  0.0 ) { 
                 double  c = stacks [ i ] ; 
                 stacks [ i ]  =  0.0 ; 
                 eq += getEquity ( payouts, stacks, total - c, player, depth +  1 )  * c / total; 
                 stacks [ i ]  = c; 
               } 
           
           return  eq; 
         }
      


      Quelle: http://www.holdemresources.net/hr/sngs/icm/icmjava.html