PascalPons / connect4

Connect 4 Solver
GNU Affero General Public License v3.0
273 stars 50 forks source link

Incorrect node score #31

Closed Herohtar closed 9 months ago

Herohtar commented 9 months ago

https://github.com/PascalPons/connect4/blob/d6ba50d8aaf2308c769d9bf2abd42d90f34baf41/Solver.cpp#L45-L47

The score being computed here seems incorrect. It is calculating the score of the current node, but since we're effectively looking 2 moves ahead, the actual value of the score should be as if it were calculated two nodes down, which means it should be -(Position::WIDTH * Position::HEIGHT - 2 - P.nbMoves()) / 2. This seems to significantly increase the performance of the algorithm.

Herohtar commented 9 months ago

Nevermind, after looking at it more closely, I'm pretty sure the original is correct.