Hey Tim, great video. I think the reason why the AI king kept boing back and forth on the last two rows, is because of a bug in your program. If a king lands on the "king row", the king counter is increased despite no new king having been created (a piece can't be a double king). Given that this king counter is part of the algorithms scoring function, it used this bug to increase its own perceived score.
@aaronwtr11503 жыл бұрын
I noticed this as well, and I made sure that a single piece could not become a king more than once and even then this issue persists... @techwithtim any suggestions?
@aaronwtr11503 жыл бұрын
I have been playing around with it for a bit now and I think I have narrowed down the problem. The minimax seems to consider a single piece at a time. If the piece has valid moves available, it takes them. If there are none, it skips to a next piece. So when a king is made and this piece it selected, the king will just move around, since its moves are valid. I am to find a way to fix this ..
@MD-ji7dh2 жыл бұрын
@@aaronwtr1150 were you able to solve the issue? Can't find any solutions and it's pretty anoying for the game to end after on ai got one king
@aaronwtr11502 жыл бұрын
@@MD-ji7dh I have fixed that particular issue, but there still are some bugs even if that bug is fixed. For example, the AI seems to select a single piece at random and ONLY moves that piece until it is captured or makes a king.
@MD-ji7dh2 жыл бұрын
@@aaronwtr1150 could you please tell me what's the solution of the repeating king? I have tried for so long to find the issue
@spark15393 жыл бұрын
just want to say your a god send, got a project for AI class and the teacher showed us no code on how an ai might look or function so this was and is endlessly helpful.
@bradmclean49883 жыл бұрын
Sounds like we have the same class
@justins77963 жыл бұрын
same here. Is your teacher's last name Li?
@bruhmomentum07342 жыл бұрын
same here
@softknk14224 жыл бұрын
The idea of you with storing possible moves in a map data structure helped me a lot .. Thanks for that!
@Fersko4 жыл бұрын
It's great to have someone who speaks normal English and can explain the programming properly. Thanks a bunch, Tim
@dpskane4 жыл бұрын
I deviated with my coding during the first 3 parts and I am glad that my board state has a list of the pieces instead of the actual number. Makes the whole process of finding pieces easier.
@DarkusNights2 ай бұрын
Old tutorial but this actually helped me for my classes and adapt your methods to my own code.
@chinonsodimgba76893 жыл бұрын
Nice one, I followed this tutorial and have been able to implement the checkers game using dart and flutter, but the pain comes in the AI keeps making unimaginable wrong moves, mostly because they do not know that it is possible to kill more than one enemy in one turn and the position of the pieces do not matter, so for that reason I have been working on making the algorithm take note that a player can kill more than one enemy in one turn and improve on the scoring formula
@amankaushik58334 жыл бұрын
Hi tim thanks for making the second part! as always I just love watching your videos related to any topic!
@shaharyarahmed57774 жыл бұрын
Recursion is always confusing but after a lot of thinking you can finally get your head around it.
@manfredreinsch84484 жыл бұрын
Hi Tim, very nice tutorial, well done! I have one question. one remark and two ideas how to extend and even improve your checkers tutorial. In your evaluate method there is a factor of 0.5 for the king piece. Because a king piece is more valuable than a normal piece, shoudn´t that be a factor of 1.5 ? Of course your algorithm will find the best way to win or just to avoid a lose according to your evaluation method , but it can not handle a draw. Consider an obviously drawish situation, e.g. just one red and one white king remaining; the AI will keep on trying to win, while the human player gets bored and sacrifices his king to end the game. In chess there are rules to avoid such a situation. You might add a chesslike rule for offering, accepting or even force a draw, when there was no capture amoung the last x moves. Yes, I am aware that you considerd alpha-beta pruning and rejected it for your current implementation, probably because it seems to be too "technical" for you. Still alpha-beta pruning will accelarate your algorithim by a factor of one ore even two according to depth. Therefore you can easily show, how a slight change in your code will improve an algorithm by a great amount. Because you have implemented a representation to show the effects of the speed of your algorithm depending of the depth in a very nice way, you can present the accelation by alpha-beta pruning visualy. If there are only a few pieces left on the board, you might consider to add an end-game database in your program, which is i.e. offered by the Canadian world best checkers program Chinook for free use. This might be even an idea of merging your checkers- and Mango-DB-Tuts...
@fisheatsyourhead2 жыл бұрын
There is meant to be a 25 move rule where 25 king moves each with no captures forces a draw
@victor202144 жыл бұрын
Tim has been an inspiration to code and teach code. I'm from a country where coding isn't as popular and learning it through time has been great. and maybe its time for the bird to fly on its own. hope you will help my endeavour in this quest
@Kobbiemainoocomps4 жыл бұрын
i know what you mean. ill support you.
@williamikennanwosu2 жыл бұрын
Thanks for the video Tim!
@ashwanirai83244 жыл бұрын
Sir, if I am doing it for AI vs AI it is showing error at the end states that Attributeerror Object has no attribute winner
@anzarrabbani37665 ай бұрын
36:43 can some1 pls help me, it keeps saying: File ---------------------------------------------------------------------, line 43, in get_all_moves for piece in board.get_all_pieces(color): TypeError: 'int' object is not iterable
@ohgreatone1381 Жыл бұрын
Tim great video but there are several "bugs' First as you and anther person mentioned the white king goes to the bottom and stays there. Bouncing back and forth between two squares. I believe someone found a solution but it did not get posted. Additionally, randomly the White King will move from the lower square where it is bouncing around and suddenly goes 6 squares diagonally to jump over a red piece. This is not supposed to happen in any version of checkers I have ever played. Could you please post the correction for the White King bouncing around. Thank you
@showmickkar77934 жыл бұрын
Hey Tim, just out of curiosity, in a video you said you do all you programming on linux. Why do use windows for making tutorials?
@ahmedthegreat39734 жыл бұрын
He Said That Most Good Video Editing Softwares Are On Windows
@КириллПопов-о3с4 жыл бұрын
Hey Tim! My english is bad, but i try to ask you a question. In your minimax function you do something like that for move in get_all_moves(position, WHITE, game): . So you store all game tree. Can you answer how much memory your program uses with depth different depth. Ty!
@gilbertocisneros853 жыл бұрын
Can this be implemented with the real checkers rules? The jump in not optional and with different levels? In a website
@ohgreatone1381 Жыл бұрын
Also, you mentioned that you were going to show us how to make the computer play itself. I tried adding a if game.turn == RED statement like the WHITE statement but it only allows the white pieces to move and the game ends with the white pieces moving down and blocking the red pieces.
@manfredreinsch84484 жыл бұрын
Hi Tim, I have just found another minor problem: It is possible to blockade your opponent, i.e. he is unable to draw while you can make one or more moves. So "no move" shoud be an option for possible moves!
@fisheatsyourhead2 жыл бұрын
no possible moves means you lose, even if you have pieces on the board. Unlike in chess where no possible moves with pieces is a draw.
@sachinsinghal133 жыл бұрын
Hey Tim, Thanks for everything, the other checkers series and this checkers series were awesome. Though, I have been trying for long time to make the game so we can undomoves as well, but I'm unable to. How can we make the unndomove function?
@sevendoesstuff Жыл бұрын
if you save all the moves played in a list then when the back arrow (or whatever key you want) is clicked delete the last move done and then quickly play all the moves in the list from the start position then do display.update() that should do it. you could also save all the board positions in a list / matrix and delete the last position in the list and set it to the now last one (the one before it). the ladder takes up much more space as you have to save every single board position from the start while the first just saves 2 points (where it was and where it moved too) but it is a bit more complex.
@AliHaider-bc7cl8 ай бұрын
i keep on gettin the game object not iterable error.. any help?!
@matthewzamat33313 жыл бұрын
Hey Tim! Thanks for the video. Is there any way we could create a function to make this checkers AI play against itself? how would we have to modify this code?
@ohgreatone1381 Жыл бұрын
Also found that the list of valid moves for RED fail when approaching row 0. I can double jump everywhere on the screen except when the last move results in a KING. White can do a double jump but not the RED player
@crjcpj91004 жыл бұрын
Hi Tim ,i really like your color theme on vscode how did you do it. what's it called.
@tomiolah5137 Жыл бұрын
I haven't watched this video yet but I plan on doing it soon. Is it possible to build a chess AI based on this?
@wiwikkarlina44473 жыл бұрын
thanks for the video! but i still dont get how the static evaluation of position in minmax at depth = 0 get passed up to the parents?
@MD-ji7dh2 жыл бұрын
if you debug you can see the return statement isn't exiting the whole function but the current recursion
@AfrasiabAhmadSU__O_OO_OO4 жыл бұрын
which color theme and font are you using currently
@SnoozeTheRecluse Жыл бұрын
I keep getting AttributeError: 'NoneType' object has no attribute 'winner'
@divyanshsingh26144 жыл бұрын
Hey bro, can u please bring a tutorial on React.Js It would be of great help.
4 жыл бұрын
Hey Tim! Is your website down or you are using a new domain?
@programmatore3 жыл бұрын
where can i begin this game project....new programmer ho can understand this..............................000000000000 value
@ruchi7274 жыл бұрын
you got a new sub!!!
@EmmnauelPeace4 жыл бұрын
Thanks so much for this hard work this can further be use in robots to make them take better decision as humans ...Well we need to explore more on this min-max algorithm with neural networks and others .When these algorithms are used in combination it really makes it very difficult for humans to beat computers in context. Great work..Best regards
@tiagozpt7743 Жыл бұрын
Friend u know gamezer ? Rules u cant create this rules checkers ?
@ahmedthegreat39734 жыл бұрын
Tim I Cant Access Your Website Its Shows Account Suspended. If Its A Bug Please Fix It Please
@richardtarbell9464 жыл бұрын
I also ran into this issue earlier. I think it is fixed now.
@ahmedthegreat39734 жыл бұрын
@@richardtarbell946 Okay Ill Check Thanks For Letting Me Know
@ahmedthegreat39734 жыл бұрын
@@richardtarbell946 No I Checked It. Its Not Fixed
@richardtarbell9464 жыл бұрын
@@ahmedthegreat3973 You're right my b. I was looking at this link tech-with-tim.teachable.com/ rn other one is still down.
@namo29434 жыл бұрын
nice i just open youtube and saw this
@alcalina6364 жыл бұрын
Hello, how are you? did your site just get down? tks
@kae48814 жыл бұрын
nice video!!
@kotvkvante224 жыл бұрын
where can I donate to you? paypal doesnt work for me
@avigupta60644 жыл бұрын
Donate me instead😔
@kotvkvante224 жыл бұрын
@@avigupta6064 did not deserve
@techwithomar18754 жыл бұрын
I was literally watching the checkers video
@RohanKumar-zd3pc4 жыл бұрын
Hey Tim, When I tried to reach techwithtim. Net then it showed "account suspended"
@shaharyarahmed57774 жыл бұрын
Same here
@danielros77984 жыл бұрын
I got this error and don't understand how to fix it File "main.py", line 47, in main() File "main.py", line 27, in main value, new_board = minimax(game.get_board(), 4, WHITE, game) File "C:\Users osda\Documents\Python\Checkers met AI (MiniMax)\minimax\algorithm.py", line 15, in minimax evaluation = minimax(move, depth-1, False, game)[0] File "C:\Users osda\Documents\Python\Checkers met AI (MiniMax)\minimax\algorithm.py", line 8, in minimax if depth == 0 or position.winner() != None: AttributeError: 'list' object has no attribute 'winner'
@johnathanindigo33404 жыл бұрын
same here, did you manage to fix it?
@danielros77984 жыл бұрын
@@johnathanindigo3340 that's a lot of code, I am going to my PC now and then I'll send it :)
@danielros77984 жыл бұрын
@@johnathanindigo3340 hey, I don't know exactly what I changed so I have the whole code here in a hastebin: hastebin.com/adoqinidom.properties
@johnathanindigo33404 жыл бұрын
@@danielros7798 hey, so this one works?
@danielros77984 жыл бұрын
@@johnathanindigo3340 Yes
@markgatere50074 жыл бұрын
Hello Sir, Am a High School student. Kindly advise me and other high school guys who have interest in tech on Computer Science majors in University or college to later have an internship or job in the top high-tech companies like Google.
@TheFonurb3 жыл бұрын
After following this tutorial, i realized i'm probably the worst checkers player in the world... even the 1 depth AI could beat me one time T.T
@artmancs41082 жыл бұрын
I'm doing a project where we want a robot playing as the AI, for this I need to have the coördinates (row, col) of the final move it took in a list variable. That way I can link these variables to points for the robot. I've been struggling to get this variable out of the program. Should be simple but I can't figure it out haha. Someone help this poor fellah out
@tahalyousfi4 жыл бұрын
Great work Tim
@renuaggarwal76604 жыл бұрын
hey bro pls. provide link to the Asset file too . it would be a great help
@shiehuapiaopiao3 жыл бұрын
It's in the description.
@georgianabhishek35614 жыл бұрын
perfect just opened pycharm
@duncansutherland59173 жыл бұрын
goat
@gilbertocisneros852 жыл бұрын
This is not American checkers rules because jumps must be mandatory
@ganapathypt64104 жыл бұрын
🖤
@ahmedthegreat39734 жыл бұрын
Please Create A Video About Creating A Slack Bot In Python
@MD-ji7dh2 жыл бұрын
pretty sure he has one
@נועםאיפרגן-ל7ע3 жыл бұрын
44:40
@PAuLXPlain4 жыл бұрын
Assistant Didn't work Please help
@alenvarghesec.k80014 жыл бұрын
Why not make python hacking series? (Or you can't do dat)