Hello again…

I think this is the most difficult question i have, because i don´t know how to do this…

But i have a lot of information and maybe anyone can help me… alone will be impossible to me =(

I tryng to create a poker app… and in this game you can make deals, we usually do when there are 9 players left

The algorithm here:

Link from this images: https://www.holdemresources.net/misc/pdf/evaluation_of_equity_models.pdf

Session 2.1

This is possible too:

Here is the algorithm:

Given n players

Given stack sizes **S** = S1, S2, … Sn

Given prizes **Z** = Z1, Z2, … Zn

Get normalized stack sizes **Q** = Q1, Q2, …Qn by dividing **S** by average stack

Simulate 1 tournament:

For each player i, generate a “place” for each player (Pi) by generating a random number between 0 and 1 and raising it to the power of 1/Qi. Pi = rand ^ (1.0 / Qi)

Sort players by their place **P** – higher is better

Award prizes **Z** according to **P**

This last information many people create this algorithm in 2 different language… maybe help…

Java:

import java.util.Arrays;

import java.util.Comparator;

import java.util.Random;

public class SimulatedIcm {

```
private Random rnd = new Random();
public double[] getEquities(double[] payouts, double[] stacks,
int maxIterations) {
if (payouts.length > stacks.length)
payouts = Arrays.copyOf(payouts, stacks.length);
double[] equities = new double[stacks.length];
double[] exp = getExponents(stacks);
final double[] r = new double[stacks.length];
Integer[] ids = new Integer[stacks.length];
for (int i = 0; i < ids.length; i++)
ids[i] = i;
Comparator<Integer> comp = new Comparator<Integer>() {
@Override
public int compare(Integer i1, Integer i2) {
if (r[i1] < r[i2])
return 1;
if (r[i1] > r[i2])
return -1;
return 0;
}
};
for (int iteration = 0; iteration < maxIterations; iteration++) {
for (int i = 0; i < r.length; i++)
r[i] = Math.pow(rnd.nextDouble(), exp[i]);
Arrays.sort(ids, comp);
for (int i = 0; i < payouts.length; i++)
equities[ids[i]] += payouts[i];
}
for (int i = 0; i < equities.length; i++)
equities[i] /= (double) maxIterations;
return equities;
}
private static double[] getExponents(double[] stacks) {
double t = 0;
for (double s : stacks)
t += s;
t /= (double) stacks.length;
double[] exp = new double[stacks.length];
for (int i = 0; i < stacks.length; i++)
exp[i] = t / stacks[i];
return exp;
}
public static void main(String[] args) {
SimulatedIcm sicm = new SimulatedIcm();
double[] payouts = new double[] { 50, 30, 20 };
double[] stacks = new double[] { 1000, 2000, 3000, 4000, 5000, 6000,
7000, 8000, 9000 };
double[] eqs = sicm.getEquities(payouts, stacks, 1000000);
System.out.println(Arrays.toString(eqs));
}
```

}

Python:

from random import random

def trial(weights, payouts):

scores = sorted((random() ** weight, i) for i, weight in enumerate(weights))

results = [0] * len(payouts)

for payout, score in zip(payouts, scores): results[score[1]] = payout

return results

def sicm(stacks, payouts, trials):

avg = sum(stacks) / float(len(stacks))

payouts += [0] * (len(stacks) - len(payouts))

payouts.sort()

weights = [avg / s for s in stacks]

return [sum(player) / float(trials) for player in zip(*(

trial(weights, payouts) for i in xrange(trials)

))]

# I guess I should add an equivalent test to be fair to the Java implementation…

if **name** == ‘**main**’:

print sicm([1000 * n for n in range(1, 10)], [50, 30, 20], 1000000)

Link about this scripts: https://forumserver.twoplustwo.com/15/poker-theory/new-algorithm-calculate-icm-large-tournaments-1098489/

My app is here:

So the calculation will shows under ICM (Column 4)

Anyone know how to do this?

You can take real proof of the calculation here:

or

https://www.holdemresources.net/icmcalculator

I just need finish him… =/

If i do anything wrong, sorry… i just dont know i can’t do this

And so much thanks for anyone help me =) i have no ideia how do this.