#MiniMax Algorithm for Tic-Tac-Toe doesn't work.

1 messages · Page 1 of 1 (latest)

violet pumice
#

I followed this tutorial: https://www.youtube.com/watch?v=trKjYdBASyQ even if it isn't in C++ I was able to recreate everything. Tho when I run my program the Ai just goes from the first available till the end so and so forth. TL:DR: It doesn't really think its moves. This is my AI Code:
https://pastebin.com/0uPHMCni
Also, the variables are declared good (I checked) The only problem is the way the AI thinks which I checked its code like 700 times so far yet I don't see nothing wrong from the tutorial.

In this challenge I take the Tic Tac Toe game from coding challenge #149 and add an AI opponent for a human player by implenenting the Minimax algorithm. Code: https://thecodingtrain.com/challenges/154-tic-tac-toe-minimax

🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/0zyUhZdJD

🎥 Previous video: https://youtu.be/ZCXkv...

▶ Play video
covert geyserBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

cedar cargo
#

did you try debugging it in a debugger?

#

stepping ttrough you code?

violet pumice
#

Yes I did but it seems to work fine just the results are weird

covert geyserBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.