#๐Ÿ”’ AI search algorithm in TicTacToe

11 messages ยท Page 1 of 1 (latest)

lusty flower
#

hey guys. i am implementing an AI search algorithm f. I did Minmax search and now I am working on Minmax cutoff which essentially uses a evaluation function to calcualte the best action to take. Problem is my implementation wont work and I dont know why or what steps to take in order to fix it

zinc flowerBOT
#

@lusty flower

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lusty flower
#

I know my evaluation function is kind of shit but I want to get the depth limiting first before going back to improve the function

#

when i do

return max(game.actions(state), key=lambda a: min_value(game.result(state, a), 0))

it should compare every action with the heuristic value i assigned to it, and then return the action with the highest/max value. But when I run it i am getting some sort of error because my game forces a draw and ends. which means the value returned from my minmax_cutoff likely isnt an action. Could it also be that the evaluation function is not working properly and so its messing up my minmax_cutoff? i feel like i have tried everything

lusty flower
#

nevermind i debugged it and it was because i was calling evaluation with a player parameter when the function does have one. thanks for the help guys!

vocal depot
#

with tictactoe 3x3 you can discover all branches at any depth

#

That might be interesting to you to create a minimax for a tictactoe with a larger grid

lusty flower
#

its tictactoe on any board size. i am doing minmax, minmax with cutoff, alpha beta, alpha with cutoff, and expectimax with cutoff.

#

my evaluation function isnt as good as it could be but its good enough for now

zinc flowerBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.