I made an (unstoppable) ULTIMATE Tic-Tac-Toe AI

Sdílet
Vložit
  • čas přidán 2. 06. 2024
  • A lot of people make minimax AIs for tic-tac-toe, but that's kind of boring, so I made one for ultimate tic-tac-toe. It's (as of now) beatable, but it's quite difficult to win, and with some improvements it will probably be perfect. To twist it up a bit more, instead of making it in python (like a lot of people do), I made it in javascript, so you can play it in your browser.
    Sebastian Lagues video on Minimax: • Algorithms Explained -...
    Link to itch page: Will post soon, I just have a bunch of exams and have to fix a few more bugs.
    0:00 - Intro
    0:25 - Ultimate Tic Tac Toe
    1:59 - Minimax
    3:50 - The issue
    5:33 - Attempt #1
    7:29 - Attempt #2
    9:14 - Attempt #3
    12:03 - Game Over
  • Věda a technologie

Komentáře • 20

  • @zesardine2613
    @zesardine2613  Před 2 lety +11

    Hey all!
    I finally decided to come back to this project, and I'm pretty sure I managed to fix all the issues the game has. The code is now available on GitHub, along with some side notes that I wrote. Here's the link: github.com/zesardine/UltimateTicTacToeAI

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

      Thank you for doing this! I am making this game and an ai for it as an accademic project (extra credit simester stuff) and this video has been great at helping me shape the way I want to approch the ai bit. Thanks a lot!!!

  • @gmonge6251
    @gmonge6251 Před 2 lety +4

    Thank you for this video, I was doing the exact same thing, making an AI to play Ultimate Tic-Tac-Toe and was stuck and your video helped a lot.

  • @cros108
    @cros108 Před 2 lety +3

    Hi, a few days ago I started making an ultimate tic tac toe engine of my own, cool to see others doing the same!

  • @aderitosilvachannel
    @aderitosilvachannel Před 2 lety +1

    You deserve to have more views in your video. Great video!

  • @Supware
    @Supware Před rokem +4

    Great video, seen it a couple times now :p I've been consumed by this game the last few days for some reason, and decided to try make my own AI. Totally new to minimax and board game AI in general, so it's been a steep learning curve (always found writing recursive functions super confusing)...!
    Though I do have a couple ideas I'm excited to try out once I get the recursion working -- my static eval function knows about forcing moves, which should(?) reduce required depth in most critical positions (i.e. returning +/- inf if it recognises that a player is in zugzwang). I imagine this should only be called when at least one player is very close to winning; in the same vein, I'd also like to try swapping out the eval function for another, or even just tweaking its values, based on the current phase of the game (e.g. the "zugzwang test" I just mentioned is only called in the "endgame", and isn't there something to be learned by pitting different opening algs against each other...?).
    Would love to talk if you're still interested in the project!

    • @zesardine2613
      @zesardine2613  Před rokem

      Hey! I was also quite new to minimax when I made this project (it was a bit of a fun challenge, you know), and I do agree that recursive functions are extremely confusing :D To be honest, it seems like your approach is far more organized than mine ever was, and I think most of my thought process was documented in the video (that's really about as much help as I can provide on this topic :D). I wish you the best of luck!

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

    so for every empty slot you let the minimax algoritm give it a score, and then you just pick the slot with the highest score? so when you take the score board on 13:00, you would have picked the slot with score 5 (right center, and than the center slot)?

  • @vanminh4502
    @vanminh4502 Před 6 měsíci +1

    Very nice video, what if I want to change the ai to 1, which parts do i need to change? thank you

  • @dodongogaming5526
    @dodongogaming5526 Před rokem +1

    I would despratly need, for school project, your final evaluation function in attempt 3.

  • @cokomairena
    @cokomairena Před 6 měsíci +1

    I would like to see an ultimate tictactoe zero bot

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

    12:54 I can't understand why you have this board, how do you add score to it? Can you explain it in details?

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

      Hey! Basically, the AI runs minimax on every empty square, meaning that one by one, it plays on all the squares and sees how the game will evolve after that move, looking some amount of moves ahead. Based on how it evolves, it gives the square an evaluation. Finally, it chooses to play on the square with the best resulting evaluation. It's basically the same thing that happens with a normal tic-tac-toe minimax AI, except there's 81 squares it needs to go through.

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

    Post itch page!

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

      Hey, I feel like it was about time to address why no link has been posted yet, and your comment gives me an opening for that. Long story short, the AI doesn't work quite as perfectly as I thought it did. Sure, it wins a lot of the time, but it's not even close to an unbeatable AI, which is kind of what I wanted to create. I got caught up in the video production so much that I only did thorough testing after releasing it, which was frankly a hasty decision.
      I intermittently tried to go back to fix the bugs I thought were present, but honestly I got burnt out quite fast, and moved on to other projects. I kept the video up because I'm quite sure that the logic is correct, my code is just not the right representation of that logic, and I don't want to release a project in that kind of a state. I'll eventually try to come back to it, or at least post a GitHub link to the code I have, but probably not in the near future, I'm sorry.

    • @user-di6wf9fs7t
      @user-di6wf9fs7t Před 2 lety +1

      @@zesardine2613 is it possible if you could personally send the code (even if it doesnt work right)

  • @user-gu4ob5ol6e
    @user-gu4ob5ol6e Před 2 lety +1

    there is a way to convert this amazing into desktop app?

  • @ViliamF.
    @ViliamF. Před 2 měsíci

    0:49 Hey! X goes first, not O. What is this nonsense...