Best Monte Carlo Simulation ?

loichillion

New member
Joined
May 9, 2020
Messages
1
Hello World,
(My problem is purely mathematical and algorithmic, it is not a computer science problem :))

I would like to create an IA for connect four, and so I want to use MonteCarlo simulation (Just MonteCarlo, not UCT).

From what I know and understand, MonteCarlo method mean play many random match et make conclusion from their ending stats.

So, my first idea whas this one: for evaluate a move for the current match: virtually set the pawn where I want evaluate that move, and then play many random games and make an evaluation from the informations in their ending stats.

My problem is: What formula should I use, to have the best results ?

1) Number of wins / Number of random played matches ?

2) Number of wins / Numbre de lose ?

3) Mean score / Number of random played matches ? (Score: -1 = perdu | 0 = match nul | 1 = Gagné )

4) Mean number of turn to win / Mean of the number of turn to lose ?

5) Or may be a formula that use the proportion of wins and the mean number of turns to win or to lose(For example, I think a win after 20, less than a win after 10, and is also more uncertain, as the number of opportunities increases)

Thinking about it, I also wondered, instead of playing N parts to evaluate each shot (Which makes 7*N parts in all, because the power 4 has a width of 7 squares), one could play not only N parts, and draw conclusions for all 7 shots to be evaluated…

For example, from a part of a data, I want to know what shot have the best potential. So I would play N games, then at the end of each one, I would look at how many times was played every shot I try to evaluate, how many times when playing it, we won, or we lost, etc…
If this approach were valid, it would be 7 times faster than the previous one, but it would also bring me back to the previous problem:

What formula should I use to get the most information from all these end-of-game games, to have the most effective AI possible??

I really hope that there is a way to answer it mathematically, without having to experiment with all these combinations

Thank you in advance to all those who will have the courage to plunge into my thorny problem
(ps:i am sorry about my english, because i am french ^^')
 
Hi, welcome to FMH!

Method 2 could result in a divide by zero, therefore it's probably not the best.

This wikipedia page seems to suggest (wins + draws*0.5) / (number of games considered). This formula would be applied separately for each of the (up to) 7 move options.

But if you want to experiment then I advise you to write the code so that the computer can play itself for several consecutive games. Player A and B could each use a different algorithm. Obviously the algorithm that wins the most matches will be best!

This sounds like a fun project.
 
Top