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 -...
Great explanation, you were the reason i got into AI man!
Did the minimax ai just give up his queen on move 3 ?
I think its because its because its playing on low depth
@@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
This has to be a joke ai.
xdddd
Hey , that's a vey good explanation , thank you
Good explanation!!
Amazing video!
Good video
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
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
how can be fixed?
@@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)
But how did you move the each item based on the minimax
how would you increase the depth?
nice vid, but what about tactics🤔🤔🤔
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
in which software i should run this code?
Hi! Nice video. How do you calculate all legal moves?
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
@@jesse578 Why would I use PYTHON for chess. So inefficient, no? LOL
Will the AI be able to deal with sacrificial moves?
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.
how we can set difficulty ?
lowering or increasing depth
how do we make the gui... Also did you use the existing chess engine library in python?
you can program the game with GUI with unity using C#
@@pedroduran8927 how would you then use the python script with the unity ui?
@@mixolydian3498 You have to code the game in C#. C# is pretty easy to learn
@@pedroduran8927 yeah i know c# and have the game setup but how would i incorporate the python script for the ai
@@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.
Hello, I added the codes in the video but it didn't work. What could be the reason?
beta is always less than alpha in the first recurseion