antirez / connect4-montecarlo

Simple connect 4 AI using Monte Carlo method
31 stars 5 forks source link

This is not an issue #1

Closed linghuazaii closed 7 years ago

linghuazaii commented 7 years ago

2,3,2,3,5,4,2,4,5, get a win. Are you learning AI now?where should I start?

antirez commented 7 years ago

Hello @linghuazaii, yes the very simple AI used in this example has many positions that are not evaluated in a smart way, because in your example, for the AI placing in row "5" was making it more probable both to win and to lose with random games. This simple implementation basically lacks understanding of the game dynamics, and only evaluates positions. In order to make it stronger, it is possible to use Monte Carol tree search which uses back propagation (not in the neural network sense) and is stronger, or minimax or other classical algorithms.

Re me learning AI, I was always interested in this field, and years ago wrote examples chess and connect four games based in minimax, I'm also interested in neural network, genetic algorithms and genetic programming. However this coding example is not about AI actually, but wants to show more how Monte Carlo method allows to somewhat solve problems without having any understanding on the dynamics of the problem itself, but just via sampling, which is very surprising.

Btw one thing that would be interesting to try is to change this connect 4 program in order to evaluate wins and loses in random games based on the number of moves needed in order to reach such a state. Maybe the program becomes stronger in this way.

linghuazaii commented 7 years ago

@antirez Thanks for so detailed explain. 👍