abassibe / Gomoku

2 stars 0 forks source link

The Python part ends the game too soon with alignment of 5 (Critical) #52

Closed demonoidv closed 3 years ago

demonoidv commented 3 years ago

Currently, when one plays a move that completes an alignment of 5 stones, the Python part assumes that the game is over. Here is an example of what I mean: Capture d’écran 2021-03-09 à 14 28 49

In this case, if black plays in the red circle, the Python part will end the game while there are actually still playable moves as stated in the subject:

Game-ending capture : A player that manages to align five stones only wins if the opponent can not break this alignment by capturing a pair, or if he has already lost four pairs and the opponent can capture one more, therefore winning by capture. There is no need for the game to go on if there is no possibility of this happening.

So in this particular case, the game should not be over because if black plays in the red circle then white can play a counter move to capture two black pieces and break the alignment. We can see in the picture that the IA is well aware of that and then will not even try to play in the red circle, instead, it will play the just above and thus capture the 2 white pieces on the left, which removes the capture threat on its potential 5.

Feel free to ask for more detail if you need some.

demonoidv commented 3 years ago

I know this is probably not something trivial to do, but if we can focus on this one as soon as possible, it would be really awesome! Actually, I can't really make a better AI without this feature because I can't verify that the AI plays well on tricky moves (I often see the AI "let" the player win with a 5 in a row, but in fact, the AI can still win, by capture for instance.

So, until this issue is fixed, we will always think that the AI plays wrong where it's actually planning a really good move.

demonoidv commented 3 years ago

This is a reminder of what remains to do on this issue. Actually, #79 does a great job at the moment I'm writing this. The only issue I see so far is the fact that the game should continue also when there is an unbreakable 5 but the opponent already has captured 8 of the player's stones and has the opportunity of capturing one more time, hence, winning by capture even is there is still a 5 in a row for the player.

Don't hesitate to ask for more detail on that one as it could be tricky to understand the subtilities and because my English is probably not helping at all!