Creating an AI that Plays Chess (Minimax Algorithm + Alpha-beta Pruning)

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024
  • [Fall 2020] Week 2: Chess Workshop by Troy Good
    Learn how to make an AI that plays chess using the Minimax algorithm optimized with alpha-beta pruning.
    ===
    GitHub Repo: github.com/aia...
    Google Slides: docs.google.co...
    ===
    Questions?
    Ask them in our Discord!
    / discord
    ===
    Additional Resources
    Video on Alpha-beta pruning: • Algorithms Explained -...

Комментарии • 35

  • @SanadMarji
    @SanadMarji 3 месяца назад

    Great explanation, you were the reason i got into AI man!

  • @lilakouparouko1832
    @lilakouparouko1832 3 года назад +11

    Did the minimax ai just give up his queen on move 3 ?

    • @z3n691
      @z3n691 2 года назад

      I think its because its because its playing on low depth

    • @georgeb9285
      @georgeb9285 2 года назад +1

      @@z3n691 if the evaluation function is based on material it makes zero sense to give up the queen on move 3 no matter the depth

    • @mearetom
      @mearetom 2 года назад

      This has to be a joke ai.

    • @khalidbadawi8216
      @khalidbadawi8216 Год назад

      xdddd

  • @mmkvhornet7522
    @mmkvhornet7522 9 месяцев назад

    Hey , that's a vey good explanation , thank you

  • @anubhavlavania1
    @anubhavlavania1 3 года назад +2

    Good explanation!!

  • @RF-xx8re
    @RF-xx8re 3 года назад +1

    Amazing video!

  • @corcoleison
    @corcoleison 3 года назад +2

    Good video

  • @benjaminwolff5990
    @benjaminwolff5990 3 года назад +6

    Hello, nice video! However, there seems to be an issue with the code shown at 7:21. Since the minimax function gets passed in values of inf and -inf for alpha and beta, the comparisons "if beta

    • @benjaminwolff5990
      @benjaminwolff5990 3 года назад

      I believe that, instead, the call to minimax in chess.py should pass in -inf for alpha and inf for beta. Also, it may be more accurate to the algorithm for the comparisons to be “if beta

    • @alessiodvt
      @alessiodvt 2 года назад

      how can be fixed?

    • @ricardomorim9444
      @ricardomorim9444 6 месяцев назад

      @@alessiodvt i'm kinda late, but i guess it can be fixed, by keeping in count an parameter with the recursion number, and checking if its different than 0 in the if.
      (assuming you start the number as 0)

  • @DarpaSeven
    @DarpaSeven 26 дней назад

    But how did you move the each item based on the minimax

  • @mixolydian3498
    @mixolydian3498 3 года назад +2

    how would you increase the depth?

  • @surpris5269
    @surpris5269 25 дней назад

    nice vid, but what about tactics🤔🤔🤔

  • @chinosts
    @chinosts Год назад

    Hey there.. Are you still up for a Discord chat about how this works? I am trying to complete a project for university and to get a better understanding of this function would be enormous help. Cheers

  • @ehsannoor585
    @ehsannoor585 Год назад

    in which software i should run this code?

  • @flora5090
    @flora5090 3 года назад +2

    Hi! Nice video. How do you calculate all legal moves?

    • @jesse578
      @jesse578 3 года назад +1

      you can use the python-chess libary to get the board and also all the legal moves with [*board.legal_moves] to get the list

    • @ziquaftynny9285
      @ziquaftynny9285 3 года назад +3

      @@jesse578 Why would I use PYTHON for chess. So inefficient, no? LOL

  • @pavankumar8673
    @pavankumar8673 2 года назад +1

    Will the AI be able to deal with sacrificial moves?

    • @khalidbadawi8216
      @khalidbadawi8216 Год назад

      ofc not, chess engines are too complicated nowadays, it took them until 1997 to beat Kasparov(Top1 player back then) u need to put more work to build a chess engine, this engine in the video is a joke, but good concept only.

  • @keshavfresher1765
    @keshavfresher1765 3 года назад

    how we can set difficulty ?

    • @person0809
      @person0809 Год назад +1

      lowering or increasing depth

  • @vtech8543
    @vtech8543 3 года назад +1

    how do we make the gui... Also did you use the existing chess engine library in python?

    • @pedroduran8927
      @pedroduran8927 3 года назад +1

      you can program the game with GUI with unity using C#

    • @mixolydian3498
      @mixolydian3498 3 года назад

      @@pedroduran8927 how would you then use the python script with the unity ui?

    • @pedroduran8927
      @pedroduran8927 3 года назад +1

      @@mixolydian3498 You have to code the game in C#. C# is pretty easy to learn

    • @mixolydian3498
      @mixolydian3498 3 года назад

      @@pedroduran8927 yeah i know c# and have the game setup but how would i incorporate the python script for the ai

    • @pedroduran8927
      @pedroduran8927 3 года назад +1

      ​@@mixolydian3498 You have to implement the AI in C# too. You can implement the minimax in C# with ease if you know how to do it in phyton.

  • @r3d4pple17
    @r3d4pple17 2 года назад

    Hello, I added the codes in the video but it didn't work. What could be the reason?

    • @nicholasmoen5066
      @nicholasmoen5066 2 года назад +1

      beta is always less than alpha in the first recurseion