Hello!

I am new user of this forum, and I want to ask you for ideas for finding the probability of winning in pre-flop, post-flop etc...

For example, there are 3 players on the table (2 opponents).

A (spade) A(heart) (1st opponent's cards)
A (club) 8 (club) (your cards)
7 (club) 8 (heart) (2nd opponent's cards)

Your percent of winning is:
9.89
4.97 chance of equal splitting the pot

I know how to solve the problem with brute-forcing method and Random function but I want to work smart and not hard.

I want to program this in Java or C++. If I use visual programming I'll use Java.

Thanks in advance.

Regards.

Could you show us the brute-force method you use to solve this?

I coded the program in Visual Basic, and the code is little messed up (hard to follow) and it have a lot of nested loops.

I have used the nested loops for checking whether the player has two pairs, three of a kind etc... and it's very time consuming.

Also for generating >400 random hands, for 3 players it takes 30 sec. or more.

I do not know much about data structures and algorithms, so I need some proper technique for working smart and not hard.

Thanks in advance.

Can you explain your algorithm in English?

I already explained it. Sorry, for saying but it seems like you are not experienced poker player.

Please, if you can not help me do not hijack my thread.

Thank you.

I have played poker.
If you won't explain your algorithm, how can anyone help you program it?

Is this a java programming problem or a quest for an algorithm?

Sorry, but why I need to explain something that I did in the past, and have not any connection with what I am going to program in future?

As I said, the algorithm before used random generating hands. I do not what to do that. I want to use some mathematical formulas, and some clever ideas.

Now, let me explain what is bad idea:

Let's say I have 2 opponents and I have pair of jacks or whatever.

All possible combination that can occur at my opponents cards are 690,900. I do not what to go through all of them and check my possibility of winning. But what about the pre-flop? If I multiply 690,900 by 46_C_5 so that I will get all possible combination of the hand it would take 690,900 * 1370754 = 947053938600 ~ 9,47 * 10^11. And that is an enormous large number. But wait a minute... What about checking whether the player has three of a kind, two pairs, full house... It would need at least 9,47 * 10^11 * 5!. The newest Intel Core i7 couldn't carry out this amount of combination.

That's why people invented RNG. But RNG is approximation of the real probability. So as much as the number of generated hands goes to infinity the approximation is better and better.

I guess all computer programs which involve finding the probability of winning use this technique. This technique is not so good but it works.

I need something which works better and differs from the other.

I need some idea. I do not what somebody to sit a write the whole procedure or java code!

If you have some idea, please post it.

Thank you/

Ok. Sorry, I thought this was about how to do programming in Java, but it appears that you're looking for an algorithm.

Sorry if I made you think that I need to 'convert' the code from VB to Java, but English is not my mother tongue.

Please somebody move this thread to appropriate sub-forum.

Regards.

Only idea to date:
Given Probability = nbr winning hands/total number of hands
Divide the deck into two piles depending on whether the card can change the value of any of the hands. Cards that can make a flush, straight or pair with a hand go into the useful pile, other cards go into the junk pile.
Compute the number of hands that can be dealt using the junk cards using an equation.
Deal and evaluate all hands using all the cards in the useful pile (brute force)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.