How to Create a TIC TAC TOE Bot in Python | Beginner Tutorial (Minimax Algorithm) | Part 2

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • Learn how to create a Tic Tac Toe bot in python. Hey everybody welcome to part 2 of this python series. Today we implement the minimax algorithm for tic tac toe in just a short amount of code. The link the the full project is below. Let me know what you guys think of the video and any other future suggestions you might have!
    Completed file: github.com/wat...
    Article I talked about in video: levelup.gitcon...
    Subscribe: www.youtube.co...
    On this channel we focus on all things Python. Whether it is a project tutorial/showcase, teaching different Python concepts, or just live coding this is one of the best channels for programmers. Check out my links down below and think about supporting me on Patreon👇
    Links:
    Patreon: / codecoach
    Github: github.com/wat...

Komentáře • 11

  • @Superhirn
    @Superhirn Před rokem +1

    Thanks for making this! It works perfectly. I am a beginner and I do not understand everything in this Video so MiniMax feels like a magical black box for me that just gives perfect answers but it works and I managed to implement it into my program. Thanks a lot!

  • @ndzrh_10
    @ndzrh_10 Před 11 měsíci +1

    Hey thanks for the video. I have a question. what if I want the number 1-9 to be display on the board and change to X/O only after a number is entered. How do I do that?

  • @cartoonmultiverse906
    @cartoonmultiverse906 Před 8 měsíci

    Is there an algorithm that allows the player to win randomly? However enjoyed your video and it was really helpful

  • @mrx-vx4wr
    @mrx-vx4wr Před 10 měsíci

    12:50 why the computer doesn't go straight for win?

  • @yuweiku1088
    @yuweiku1088 Před rokem

    This is a great video! One question, how do we know the depth for minmax needs? In this case, we peek two step ahead?

  • @markmands8308
    @markmands8308 Před rokem

    Great video. Everything is understandeble and i like it

  • @manoville3840
    @manoville3840 Před 2 lety +2

    What if I don’t want the bot to beat the player?

    • @CodeCoachh
      @CodeCoachh  Před 2 lety

      This would be a little more tricky you would have to make several changes to the code. I would probably modify how the points were calculated in the minimax function and before the bot makes a move i would pick a random move from the range of some value so the bot does not make the best possible move every time. I hope that made a little sense - I will look into it!

    • @CodeCoachh
      @CodeCoachh  Před 2 lety

      Hey Nate, check out this video:
      czcams.com/video/BfmivoVFins/video.html&ab_channel=ZeSardine
      he created a more advanced version of this game but the rational he used for attempt 2 at 7:30 would be how you implement a medium difficulty bot. You would have to evaluate each position on the board based on the conditions he gives in the video. Hope this helps!

  • @anolodgy.7867
    @anolodgy.7867 Před rokem

    I always get a recursionError pls help

  • @Pressado1
    @Pressado1 Před 2 lety

    Thanks for the video. I use to read subtitles, and sometimes you code on the bottom of the screen, and that makes me not able to see the code clearly :/ But really thanks for the amazing explanation