mgechev / javascript-algorithms

💻 JavaScript implementations of computer science algorithms
https://mgechev.github.io/javascript-algorithms/
MIT License
7.83k stars 1.28k forks source link

Minimax implementation #171

Closed krzysztof-grzybek closed 4 years ago

krzysztof-grzybek commented 4 years ago

Fixes #167

Hi Minko, As I started implementing, I turned out that this algorithm can't be tested without any game. It just needs some game rules to decide which move will be the best.

To fix that, I implemented a simple tic tac toe game.

Another weird looking thing might be the fact, that algorithm function receives 3 function arguments. This is needed because of the same reasons.

I realize that this might be odd. If You think that it doesn't fit this repo, that's fine.

mgechev commented 4 years ago

@krzysztof-grzybek looks good! I'll add a reminder for myself to take a look at the PR in the next few days.

krzysztof-grzybek commented 4 years ago

I fixed all the issues.