MaciejKozarzewski / AlphaGomoku

AlphaZero for the game of Gomoku.
GNU General Public License v3.0
23 stars 0 forks source link

Improve Swap2 #6

Open nguyencongminh090 opened 2 years ago

nguyencongminh090 commented 2 years ago

I have a method to balance opening (swap2 with 3 stones), that is:

Hope it is helpful!

MaciejKozarzewski commented 2 years ago

Will this algorithm work with arbitrary number of stones? For example, to find 4 balancing moves for a 7 stone position?

nguyencongminh090 commented 2 years ago

I'm not sure, but it can be more complex. In that case, the first move will depend on the nearby move to make a connection and then the second stone will balance after making step 1. (Swap2 with n stones) What do you mean about "4 balancing moves for a 7 stone position"? I don't understand why 4 balancing moves. I think this algorithm only works with 2 balancing moves.

MaciejKozarzewski commented 2 years ago

This is why I asked. Algorithm currently used in AG is general - can be used to balance arbitrary position using any number of moves. I agree it could be optimized but currently I don't see any possibility for doing so.

nguyencongminh090 commented 2 years ago

Hmm... What is your current algorithm? Can you give me some example case? I wanna try, I hope I can help.

nguyencongminh090 commented 2 years ago

solution for the standard case. Because it is quite different when swap2 with 3 stones, you only have 3 stones and 1 threat from the connection of 2 stones of black but with more than 3 stones, it has a lot of potential threat, connection. Can we use 2 ways for 2 types? (I want to discuss more this problem via email)

MaciejKozarzewski commented 2 years ago

Neural network calculates probability of winning for given position. During match the search looks for a move that has highest probability of winning. During balancing I change the function to look for move that has probability of winning closest to 0.5. And that's it. This is why I think my algorithm is better as it is provably correct and not based on a heuristic approach. Look into [https://github.com/MaciejKozarzewski/AlphaGomoku/blob/master/src/mcts/EdgeSelector.cpp]() for details.

nguyencongminh090 commented 2 years ago

Hmm.... I think we need a test.

nguyencongminh090 commented 2 years ago

My testcase base on connection of 2 stones of black. Testcase 1: Long connection:

Testcase 2: Near connection:

Testcase 3: No connection.