There was actually some interesting code I done a couple decades ago on my C64 where it was a Tic-Tac-Toe game that learned. I was reading heuristic books at the time. The first time you played the game with the computer you could make a straight line and beat it in 3 moves. But it learns and you could never beat it the same way twice. Eventually, if you keep playing, it will get so good that it will become impossible to beat. It basically recorded in memory the moves that lead to a win. If it lost, it would replace the last losing move it made with the location of the winning move (so it knows to block it in the future). I think it had like, 19K memory for this with some calculations based on the move number, which side was moving to decide where in memory to store the move information. I found this method more interesting as the play could win, but it got progressively harder to beat and ultimately impossible. I may try implementing it again, if I can remember how I coded it.
Neil Roy While the idea is interesting, it just isn't a good way to program the AI. Your idea may be useful for other applications though. When a game is simple enough that looking through all continuations is possible, it's always the best solution, and I'm sure it was possible to do even a couple decades ago. Heuristics should be used after the maximum search depth of minimax has been reached and a solution was not found. The resulting positions will be judged heuristically to determine which of them is superior without looking any more moves ahead.
I see a lot of folk complaining about the broken link to the source files. Well, I found a half way solution to the problem here: github.com/jnisitha/TicTacToe This person has developed a game based heavily off of Ben's code (indeed, they provide credit in the readme), and so is a good alternative. Also, I don't normally ask this, but please thumbs up this comment and get it noticed for those who need it! Cheers.
I have spent a couple of weeks reading and watching minimax implementations for tic tac toe, and this video was the one that thought me how to do it. many many thanks.
Great vid - clearest I have seen so far on actually coding minimax, rather than just explaining how the algorithm works. I don't know C++ but I'm going to try and implement this in JavaScript.
Peter Daily Hi Peter, Can you explain me how I could update the score in the recursive call of getBestMove function using java? Or how this line works? This line: move.score =getBestMove(...) Thanks in advance
thank you very much Ben.. that really helped me... the funny thing is that your video helped a guy who lives more than 11000 KM away from you, that's awesome! thanks again.
+SSPYR0 When you are creating your chunks, you will loop through each voxel in the chunk and check its X,Z coordinate against the heightmap. If it's Y coordinate is below the heightmap y coordinate, you make it dirt. If its above the heightmap, you make it air.
It didn't take 48 videos to make Tic-Tac-Toe. It took 48 videos to give beginners a very useful set of C++ skills in order for them to understand the concepts used in building the game and to make other games.
Movinghead mau Hi, Can you explain me how I could update the score in the recursive call of getBestMove function using java? Or how this line works? This line: move.score =getBestMove(...) Thanks in advance
Really helpful tutorial for creating the Minimax Ai, before this I could only create an AI that does a random move each turn. Thanks for the help! Subbed
I've been trying for 2 days to understand this, and now I almost completely understand it after this tutorial. And I don't even know C++ xD! You're great at tutorials! Thanks! BTW: Does this use alpha-beta pruning?
+MakingGamesWithBen nice to hear your graduation went well! Keep up the good work on SoA! Can't wait for a new episode of your graphics tutorial too, hope you can get back to it soon :)
Kevin Trieu Minimax alone is not enough for checkers. Since the game is much longer and played on a much bigger board, you will also need to use Alpha-Beta prunning. Moreover, after a certain search depth the computer will not be able to look any further, so you'll need to have a hueristical function judging the resulting positions and comparing them. Bottom line is: Checkers is very very complicated.
mehoff Hi, Can you explain me how I could update the score in the recursive call of getBestMove function using java? Or how this line works? This line: move.score =getBestMove(...) Thanks in advance
Hello dude! Thank you for this great tutorial, even I'm currently using C# rather than C++. Your explanation is very clear and helpful! Now I'm able to implement this for my AI class in my college. Do you know someone or any Channel which are good at explaining or tutoring in C# like you did in C++? Thanks before :)
Hey Ben.I didn't watch the entire video yet, but I'm really enjoying the other videos. Are you enrolled in the IA from BerkeleyX from edx? We used Minimax and Expectimax in the second project of the course
I have some problem understanding the returns of AIgetBestMove.... when you enter the method, this shall return some specific score AI values...or enter the for loops for checking the moves etc ->where you enter the recursion... How does the code reach the final return to return the best AImove moves-vector?
Is this kind of algorythm is used in for example maze solving program? Something like a player is in a maze or something and there are monsters chasing after the player. So, should this kind of algorythm be used for monsters' AI?
+Dominykas Ruibys Great question! Actually the AI for a monster that chases a player though the maze is different, though conceptually similar. Rather than doing a recursive check of all possible moves (would potentially take forever), we use an algorithm called BFS or DFS (breath first search or depth first search) to find the shortest path to the target. This algorithm is actually quite fast, and there are variants such as A* pathfinding and Dikjstras algorithm that make it even faster! I will be teaching A* at some point.
DJoppiesaus That might be a fun addition, but I would like to move on to other things!DJoppiesaus alpha-beta is a way to prune the tree of possible moves to make it more efficient by not checking redundant states!
Are const variables interpeted by the compiler just as values? For example: const int CONST_VARIABLE = 3; if (CONST_VARIABLE - 3 > someVariable) would be replaced by if (0 > someVariable) ?
+MassivaRiot I understand it's like 2 months later haha... But anywho, it's this Constructor for AIMove he meant: AIMove(int _score) :score(_score) {}; So that the end score could could be found. (this struct is created in the middle of the loop in getBestScore, i'll explain it later) And to answer the second question, which also helps with the first, getBestMove returns a struct and inside that struct it has the x, y and score variables. The struct which holds those variables is created in the middle loop inside the getBestScore function, and is added to the moves vector. Then the function loops through the moves vector and finds the one with the greatest score if it wants to win and the lowest score if it wants the player not to win. Hope this helped and I didn't sound confusing! :) :) Edit: I totally sounded confusing...
Hey, i really need the code for this. The dropbox link says error and does not load the content. Please provide me with the source code through any platform if you can. Thank you.
Hi Ben, I am new on c++, I am trying to figure it out how to implement this code into my code. I am trying to build my code from scratch so it is totally different from your template. Anyway I have a question, what is the purpose using getVal and setVal inside the recursive fuctions? I am sorry for my bad English.
+gotogo It's fairly simple. "this" refers to the object itself. So lets say you have a class function for that object that takes an "x" variable, and you wish to assign the value of that "x" to the object's private variable also named "x". You could use "this->x = x" which would assign the "x" value which was passed in via the function to the "x" (this->x) which is the object's private variable of the same name. "this" simply tells the program you wish to refer to something that is part of the object itself.
Hey, liked your video, but can't really call it a tutorial since you're missing a lot of code. with just the video and no working download links. Could you re-upload it? would appreciate it.
+MakingGamesWithBen Awesome tutorial. Hey I was making the Japanese chess using minimax algorithm...could you suggest me how I can assign score to moves. Thanks in advance.
+Ankan Kumar Giri I don't think minimax by itself will work well for GO, since GO is WAAY more complicated. The number of moves you have to iterate to just go 3 moves deep is huge! I honestly don't know what algorithm or heuristics work well with GO, but I am pretty sure nobody has "solved" GO yet, like they have with chess. You will have to google around for that!
In assembler? Lord have mercy. Another testimony to how horrible the education system is. You could do it in a tenth of the effort in c++ and also use SFML or SDL for some neat graphics and music. Why do schools want us to waste our time.
@Gaming Turkey Sometimes, projects at school can be helpful (especially if you learn version control or remember to keep your code in a thumbdrive in case you don't). One thing with schools is they have to give us something that is simple enough to complete in a short amount of time, but challenging enough that we will have to do some thinking and learn. It can be hard at times for instructors to balance both of those objectives. That's not to say I completely disagree, but it's not as easy as it sounds. What I wish they'd do is quit using the traditional grading system; it's never worked well and never will.
Hi Ben, I understand that code executes from top to bottom, however I was just curious to know what would happen if every single line was executed at the same time.
What? That's impossible. The cpu can only do one operation at a time, that's why they've upgraded them to do 4 billion things per second. Even if you multithreaded you'd have to wait for the other threads to terminate and that's assuming you can make the variables do anything after they've been split up from their declarations. Quantum computing attempts to solve this using superposition, but that only compares all possible states of something at once, not necessarily running every line at once. In short, you get chaos.
I code games in java and Im really interested to learn c/c++. I found your channel and I think watch all your videos and try to learn is going to be my goal. I was thinking about coding a tic tac toe game in java, only for practicing but Im having seriously problems to understand the minmax algorithm. Actually I think I have some idea to code the AI without the minmax but is not going to be so "perfect". Anyway thank you very much for your videos!
Brute force isn't incredibly hard these days, at least not for many turn-based games. A smartphone or tablet with 4 cores and 128-bit SIMD clocked at more than ~600MHz will have more processing power than the Deep Blue supercomputer that beat Gary Kasparov at chess in 1997, so even that's within the range of modern devices.
+InnovumTechnology They're also fast enough to be able to do much more complex algorithms which would allow them to check many more moves ahead than brute force, and do it faster. So that argument doesn't really stand. If it's fast enough for brute force, than it's fast enough to use complex algorithms and do it almost instantly.
Deep Blue was by no means a "brute force" solution. It is not possible to make a chess AI using minimax alone. You will need Alpha-Beta prunning and a hueristical function judging end positions. Opening books are also essential. And there are probably more parts that I can't think of right now.
Hey Ben can I make a request on a video that you can make. I am still a beginner and wanting to move on. you are a really big help but I feel that I am lacking in the basic in the compiler "debugging" reading is not my thing but if I hear it I will understand it. what help some what is www.cplusplus.com/forum/articles/28767/ and what I want is to use the Visual Studio Express compiler debugger and (step-into and step-Over) to see the variables
+MakingGamesWithBen It is on your website or something? Please make it clear to me where exactly I can get the source code because I don't understand. What do you mean by "description"?
***** TH-cam videos have a "description" Its the area right under the video with a bunch of text. There is a "show more" text you can click that will drop down and show you the link.
I created this with minimax: fccttt.bitballoon.com/ You can check my javascript file in the source code, but I warn you, the code is ugly and not well structured. THe code also includes some old stuff that I didn't delete/refactor. I am going to remake it some time in the future.
thank you fellow camper :). I also intent to rewrite my projects before officially adding them to my portfolio. Btw, how far along the FCC curriculum are you if you don't mind me asking?
ahmad abdolsaheb I'm just done with the front end part. I'm studying React right now. I'm doing a lot of other random things outside of FCC though, like trying Electron and Angular 2.
+CodeBit awesome. I will be done front end soon and then planning to spend a month or so @teamtreehouse to familiarize myself with different libraries and frameworks. let's keep in touch, maybe we can work on a project together in the future :)
There is no sense in calculating the first AI move (if the board is empty), because the best strategy is already known - to start from corner. So in this case just pick random corner. Otherwise it's a waste of resources for nothing.
+Bizzaro Fukuro I always found the center to be the best starting spot. But this is a good point. If the board is empty (and all the AI would need to do would be to check if it is the first move), than I would have the AI randomly choose the corners or center.
actually all best moves are already known for any board position by this logic all of this has no sense but thats not right this AI plays perfectly without extra information of best move
BlueStahli DeepFocus That's just the way it works, in the industry you need to learn to collaborate and work as a team. Honestly, when it comes to game development there's very little glamour in the programming. If you really want to make a game on your own you're more than likely going to use Unity. Then you will find that its about 60% art, 3D modeling, animation, sound, and programming using the fundamentals of the engine is very trivial and also pretty minimal. If your end-goal is to make games or get into the game industry, just learn the fundamentals first. It will save a lot of hassle and frustration. Getting better at thinking and solving problems is also very essential.
No problem. :) Just keep learning and practicing. If you really want to learn c++ I suggest you checkout this book: www.amazon.com/Programming-Principles-Practice-Using-2nd/dp/0321992784/ref=sr_1_1?ie=UTF8&qid=1483117475&sr=8-1&keywords=programming+principles+and+practice+using+c Definitely has helped me a ton.
There was actually some interesting code I done a couple decades ago on my C64 where it was a Tic-Tac-Toe game that learned. I was reading heuristic books at the time. The first time you played the game with the computer you could make a straight line and beat it in 3 moves. But it learns and you could never beat it the same way twice. Eventually, if you keep playing, it will get so good that it will become impossible to beat. It basically recorded in memory the moves that lead to a win. If it lost, it would replace the last losing move it made with the location of the winning move (so it knows to block it in the future). I think it had like, 19K memory for this with some calculations based on the move number, which side was moving to decide where in memory to store the move information.
I found this method more interesting as the play could win, but it got progressively harder to beat and ultimately impossible. I may try implementing it again, if I can remember how I coded it.
Neil Roy While the idea is interesting, it just isn't a good way to program the AI. Your idea may be useful for other applications though. When a game is simple enough that looking through all continuations is possible, it's always the best solution, and I'm sure it was possible to do even a couple decades ago. Heuristics should be used after the maximum search depth of minimax has been reached and a solution was not found. The resulting positions will be judged heuristically to determine which of them is superior without looking any more moves ahead.
I see a lot of folk complaining about the broken link to the source files.
Well, I found a half way solution to the problem here: github.com/jnisitha/TicTacToe
This person has developed a game based heavily off of Ben's code (indeed, they provide credit in the readme), and so is a good alternative.
Also, I don't normally ask this, but please thumbs up this comment and get it noticed for those who need it!
Cheers.
I also found the original code.
github.com/joppiesaus/TicTacToe
@@deimien2984 Wow, thank you.
I have spent a couple of weeks reading and watching minimax implementations for tic tac toe, and this video was the one that thought me how to do it. many many thanks.
hey, Could you mind sending me the source code for this game please? the link is broken.Thanks in advance
Hello 2019 The dropbox is no more working
Great vid - clearest I have seen so far on actually coding minimax, rather than just explaining how the algorithm works. I don't know C++ but I'm going to try and implement this in JavaScript.
Peter Daily
Hi Peter,
Can you explain me how I could update the score in the recursive call of getBestMove function using java?
Or how this line works?
This line:
move.score =getBestMove(...)
Thanks in advance
thank you very much Ben.. that really helped me...
the funny thing is that your video helped a guy who lives more than 11000 KM away from you, that's awesome! thanks again.
+SSPYR0 When you are creating your chunks, you will loop through each voxel in the chunk and check its X,Z coordinate against the heightmap. If it's Y coordinate is below the heightmap y coordinate, you make it dirt. If its above the heightmap, you make it air.
The links does not work, can you PLEASE fix the links?
It took 48 videos to make Tic-Tac-Toe... hardly a "Game tutorial" LOL
It didn't take 48 videos to make Tic-Tac-Toe. It took 48 videos to give beginners a very useful set of C++ skills in order for them to understand the concepts used in building the game and to make other games.
i think you picked the best possible example to explain how the algorithm works. good job! :D
Movinghead mau
Hi,
Can you explain me how I could update the score in the recursive call of getBestMove function using java?
Or how this line works?
This line:
move.score =getBestMove(...)
Thanks in advance
3:50
We have 9*8*7*6*5*4*3*2*1 = 362 880 (permutations of 1:9) differents games of tic tac toe !!!
Excellent explanation of MinMax, especially in context of Tic Tac Toe - thank you
Really helpful tutorial for creating the Minimax Ai, before this I could only create an AI that does a random move each turn. Thanks for the help! Subbed
I've been trying for 2 days to understand this, and now I almost completely understand it after this tutorial. And I don't even know C++ xD! You're great at tutorials! Thanks!
BTW: Does this use alpha-beta pruning?
I don't think so, from my understanding each move finishes a whole game
@@funduino8322 alpha-beta would use some condition comparing two other parameters (alpha and beta).
+MakingGamesWithBen nice to hear your graduation went well!
Keep up the good work on SoA!
Can't wait for a new episode of your graphics tutorial too, hope you can get back to it soon :)
gummiwipfel I am planning on releasing SoA 0.2.0 demo Sunday the 24th, then I should have time for tuts!
Sounds great!
Looking forward to the new demo :)
Thank you very much!
Great tutorial! I implemented your code with an "alpha-beta layer" . Worked beautifully..
Thanks again ;)
+Omri Caspi Nice work man!
could i see your code
Huh, I was just reading about minimax AI for checkers. I'll definitely save this video for when I get to the point where I can implement AI.
Kevin Trieu Minimax alone is not enough for checkers. Since the game is much longer and played on a much bigger board, you will also need to use Alpha-Beta prunning. Moreover, after a certain search depth the computer will not be able to look any further, so you'll need to have a hueristical function judging the resulting positions and comparing them.
Bottom line is: Checkers is very very complicated.
Implemented this method in WinApi C++ Project! Thank you! Very informative and simple!
mehoff
Hi,
Can you explain me how I could update the score in the recursive call of getBestMove function using java?
Or how this line works?
This line:
move.score =getBestMove(...)
Thanks in advance
my brain applies this algorythm by default
Hello dude! Thank you for this great tutorial, even I'm currently using C# rather than C++.
Your explanation is very clear and helpful! Now I'm able to implement this for my AI class in my college.
Do you know someone or any Channel which are good at explaining or tutoring in C# like you did in C++?
Thanks before :)
Thanks a lot :) I just did it in C# following your tutorial :)
Hey, just letting you know your links in the description are broken. Great vid tho!
i don't know why but this part (22:15) cracked me up xD it's like the AI says "screw this crap, i ain't playin" xD
Hey Ben.I didn't watch the entire video yet, but I'm really enjoying the other videos.
Are you enrolled in the IA from BerkeleyX from edx?
We used Minimax and Expectimax in the second project of the course
Fanuel Marinho No I am not. Minimax is a pretty common algorithm!
Can you please update the two project links? They're not working anymore
@Ardi Jasari.. heyy could u find this code..??
@@aroojtahir6069 no
I have some problem understanding the returns of AIgetBestMove....
when you enter the method, this shall return some specific score AI values...or enter the for loops for checking the moves etc ->where you enter the recursion...
How does the code reach the final return to return the best AImove moves-vector?
Hello, can you reup source this code? I want to see main of this code. Thanks!
Great code, immediatelly ported it to java, because I can better see the java code, and later I need it in an android game.
hey, the code is no longer there.....can u send me the code if you have it downloaded.
Can anyone tell me if he moved the code to another site? The finished code isn't available on the link he provided.
Very Nice tutorial Ben!
+Omri Caspi: care to share your alpha-beta with us?
Is this kind of algorythm is used in for example maze solving program? Something like a player is in a maze or something and there are monsters chasing after the player. So, should this kind of algorythm be used for monsters' AI?
+Dominykas Ruibys Great question! Actually the AI for a monster that chases a player though the maze is different, though conceptually similar. Rather than doing a recursive check of all possible moves (would potentially take forever), we use an algorithm called BFS or DFS (breath first search or depth first search) to find the shortest path to the target. This algorithm is actually quite fast, and there are variants such as A* pathfinding and Dikjstras algorithm that make it even faster! I will be teaching A* at some point.
Nice! Are you going to do a video on alpha-beta next?
HoshoLegacy What is alpha-beta?
DJoppiesaus That might be a fun addition, but I would like to move on to other things!DJoppiesaus alpha-beta is a way to prune the tree of possible moves to make it more efficient by not checking redundant states!
hi, i can't get the source code, the link doesn't work
Are const variables interpeted by the compiler just as values? For example:
const int CONST_VARIABLE = 3;
if (CONST_VARIABLE - 3 > someVariable)
would be replaced by
if (0 > someVariable)
?
DJoppiesaus If you compile with optimization (release mode) then yes most likely it will be replaced by a 0!
Really helpful! Thank You!
the link does not work
Could anyone explain me what is the constructor he mentioned here ? 13:36
Thnx in advance guys :P
+MassivaRiot Also how does it get the .x and .y (in the performMove) of the bestMove ? :S 22:53
+MassivaRiot I understand it's like 2 months later haha... But anywho, it's this Constructor for AIMove he meant:
AIMove(int _score) :score(_score) {};
So that the end score could could be found. (this struct is created in the middle of the loop in getBestScore, i'll explain it later)
And to answer the second question, which also helps with the first, getBestMove returns a struct and inside that struct it has the x, y and score variables.
The struct which holds those variables is created in the middle loop inside the getBestScore function, and is added to the moves vector.
Then the function loops through the moves vector and finds the one with the greatest score if it wants to win and the lowest score if it wants the player not to win. Hope this helped and I didn't sound confusing! :) :) Edit: I totally sounded confusing...
+owndbyu Thank you very much!! That helped a lot :))))
Yay! :D Pleasure
Hey, i really need the code for this. The dropbox link says error and does not load the content. Please provide me with the source code through any platform if you can. Thank you.
can anybody give me finished code, please? links is't work
Hi Ben, I am new on c++, I am trying to figure it out how to implement this code into my code. I am trying to build my code from scratch so it is totally different from your template. Anyway I have a question, what is the purpose using getVal and setVal inside the recursive fuctions? I am sorry for my bad English.
+Jesse Kosasih getVal gets the value from the board at an X Y position, and setVal sets the value at an X Y position.
please upload a gameplay of this game
thanks for all the tutorials but i'm having a lot of trouble remembering all these codes! any tips for people like me
im getting a segmentation fault because the coordinates I'm getting from the algorithm are insane
+MakingGamesWithBen is there any chance you would be able to update the links to the code files?
How do you make this work with a 6x6 grid, where any sub row, column or diagonal of four scores a point?
Could you teach how to write the AI of five in a row? I feel so difficult to figure out the evaluation function and how to scan the chessboard.
Michael Tsai I think you mean four in a row. I've never heard of a game called "five in a row".
Question: when i change it to 5x5 board the AI does not move anymore. Is there a way to work around it?
I really need thous dropbox files! please!
Did you get them ?
@@javawithayman3678 Nope :'-(
Ben, can u please make a lesson about "this", I watched thenewboston lesson about it but I didn't understand, He didn't show any examples
+gotogo It's fairly simple. "this" refers to the object itself. So lets say you have a class function for that object that takes an "x" variable, and you wish to assign the value of that "x" to the object's private variable also named "x". You could use "this->x = x" which would assign the "x" value which was passed in via the function to the "x" (this->x) which is the object's private variable of the same name. "this" simply tells the program you wish to refer to something that is part of the object itself.
Hey,
liked your video, but can't really call it a tutorial since you're missing a lot of code.
with just the video and no working download links.
Could you re-upload it? would appreciate it.
+MakingGamesWithBen Awesome tutorial. Hey I was making the Japanese chess using minimax algorithm...could you suggest me how I can assign score to moves. Thanks in advance.
+Ankan Kumar Giri I don't think minimax by itself will work well for GO, since GO is WAAY more complicated. The number of moves you have to iterate to just go 3 moves deep is huge! I honestly don't know what algorithm or heuristics work well with GO, but I am pretty sure nobody has "solved" GO yet, like they have with chess. You will have to google around for that!
Thanks bro keep up the great work, can you do a Tetris that would teach a lot
Hi |Ben, I see that you don't use system("CLS"); to clear the console ever. Is this because it is a slow function or another reason?
Alex Di Vito system isn't cross platform and its also fairly insecure. You can definitely use it if you want, I just try not to.
A couple of years ago i did the same thing in assembler for a school project...
It was quite a nightmare xD
KapoGames That sounds rough!
In assembler? Lord have mercy. Another testimony to how horrible the education system is. You could do it in a tenth of the effort in c++ and also use SFML or SDL for some neat graphics and music. Why do schools want us to waste our time.
@Gaming Turkey Sometimes, projects at school can be helpful (especially if you learn version control or remember to keep your code in a thumbdrive in case you don't). One thing with schools is they have to give us something that is simple enough to complete in a short amount of time, but challenging enough that we will have to do some thinking and learn. It can be hard at times for instructors to balance both of those objectives. That's not to say I completely disagree, but it's not as easy as it sounds. What I wish they'd do is quit using the traditional grading system; it's never worked well and never will.
1:48
Hey Ben do you know how I would convert a heightmap into voxel terrain? Because I am utterly lost :(
He please can you help me in player vs computer tic tac Toe game code please
Hello great video but your dropbox seems to not work can you help me out please thanks
Hey, Can anyone tell me how to show the numbers counting the lines on the left side. I'm using VS 2015 community.
+Stories by John Tools > Options > Text Editor > C/C++ > Check the enable line numbers box
Hi Ben, I understand that code executes from top to bottom, however I was just curious to know what would happen if every single line was executed at the same time.
What? That's impossible. The cpu can only do one operation at a time, that's why they've upgraded them to do 4 billion things per second. Even if you multithreaded you'd have to wait for the other threads to terminate and that's assuming you can make the variables do anything after they've been split up from their declarations.
Quantum computing attempts to solve this using superposition, but that only compares all possible states of something at once, not necessarily running every line at once.
In short, you get chaos.
I code games in java and Im really interested to learn c/c++.
I found your channel and I think watch all your videos and try to learn is going to be my goal.
I was thinking about coding a tic tac toe game in java, only for practicing but Im having seriously problems to understand the minmax algorithm.
Actually I think I have some idea to code the AI without the minmax but is not going to be so "perfect".
Anyway thank you very much for your videos!
dat throat clear doe
Do you have any other link? Your link has died. I mean the file hasn't exist any longer
Can someone explain me how I could update the score in the recursive call of getBestMove function using java?
This line:
move.score =getBestMove(...)
links are not working
Hi, can you send me your source code, the link you provided is broken
Thank you very much
finally here!
Is there some problem with the dropbox??
I mnot able to download the code
Same here :(
same here.
same here :(
Source code not able to access,can make it access
Mee too
Can you please provide me with the template? Thanks
hey, can i get the source code for this game please. Thanks in advance
Anyway to make this for R?
Can any one provide template code for this code?
Awesome! And now we should implement it for Go!
DJoppiesaus Haha, Go is so complex that it hasn't been solved yet!
Can you provid the code ? Thanks
hey dude, where is the dropbox files?
Can't find the code!!
Did you suceed to find it please?
Brute force isn't incredibly hard these days, at least not for many turn-based games. A smartphone or tablet with 4 cores and 128-bit SIMD clocked at more than ~600MHz will have more processing power than the Deep Blue supercomputer that beat Gary Kasparov at chess in 1997, so even that's within the range of modern devices.
*****
Sure, but they can still check many turns ahead; a lot more than a human can. It's not perfect, but it's still pretty good.
+InnovumTechnology They're also fast enough to be able to do much more complex algorithms which would allow them to check many more moves ahead than brute force, and do it faster. So that argument doesn't really stand. If it's fast enough for brute force, than it's fast enough to use complex algorithms and do it almost instantly.
Deep Blue was by no means a "brute force" solution. It is not possible to make a chess AI using minimax alone. You will need Alpha-Beta prunning and a hueristical function judging end positions. Opening books are also essential. And there are probably more parts that I can't think of right now.
+Bizzaro Fukuro good point!
Hey Ben can I make a request on a video that you can make. I am still a beginner and wanting to move on. you are a really big help but I feel that I am lacking in the basic in the compiler "debugging" reading is not my thing but if I hear it I will understand it. what help some what is www.cplusplus.com/forum/articles/28767/ and what I want is to use the Visual Studio Express compiler debugger and (step-into and step-Over) to see the variables
i need code'
Where's the code? I'm getting 404!
Please where is the link to download the source code??
+Jimmy Santadeo description of course
+MakingGamesWithBen It is on your website or something? Please make it clear to me where exactly I can get the source code because I don't understand. What do you mean by "description"?
***** TH-cam videos have a "description" Its the area right under the video with a bunch of text. There is a "show more" text you can click that will drop down and show you the link.
+MakingGamesWithBen Oh thank you so much. :)
***** No problem :)
where's the code
mine is not working 😭😭😭😭😭😭
ok, it's working now
404 error for dropbox source code
Trying to implement this with Javascript and I think I'm going insane....
if you implemented it in JS, would you send me the link?
I created this with minimax: fccttt.bitballoon.com/
You can check my javascript file in the source code, but I warn you, the code is ugly and not well structured. THe code also includes some old stuff that I didn't delete/refactor. I am going to remake it some time in the future.
thank you fellow camper :). I also intent to rewrite my projects before officially adding them to my portfolio. Btw, how far along the FCC curriculum are you if you don't mind me asking?
ahmad abdolsaheb I'm just done with the front end part. I'm studying React right now. I'm doing a lot of other random things outside of FCC though, like trying Electron and Angular 2.
+CodeBit awesome. I will be done front end soon and then planning to spend a month or so @teamtreehouse to familiarize myself with different libraries and frameworks. let's keep in touch, maybe we can work on a project together in the future :)
How to make graphical 2D games
His next playlist!
There is no sense in calculating the first AI move (if the board is empty), because the best strategy is already known - to start from corner. So in this case just pick random corner. Otherwise it's a waste of resources for nothing.
+Bizzaro Fukuro I always found the center to be the best starting spot. But this is a good point. If the board is empty (and all the AI would need to do would be to check if it is the first move), than I would have the AI randomly choose the corners or center.
actually all best moves are already known for any board position
by this logic all of this has no sense
but thats not right
this AI plays perfectly without extra information of best move
DropBox error 404 :(
it could be more compact
2022
so ...coded 40 tutorials 20 hourse for only tic tac toe? omg how much for gta v? i think 400 years
Large scale AAA games aren't made by just one person coding.
Josh T why?
BlueStahli DeepFocus That's just the way it works, in the industry you need to learn to collaborate and work as a team. Honestly, when it comes to game development there's very little glamour in the programming. If you really want to make a game on your own you're more than likely going to use Unity. Then you will find that its about 60% art, 3D modeling, animation, sound, and programming using the fundamentals of the engine is very trivial and also pretty minimal. If your end-goal is to make games or get into the game industry, just learn the fundamentals first. It will save a lot of hassle and frustration. Getting better at thinking and solving problems is also very essential.
this was helpful thank you :)
No problem. :) Just keep learning and practicing. If you really want to learn c++ I suggest you checkout this book: www.amazon.com/Programming-Principles-Practice-Using-2nd/dp/0321992784/ref=sr_1_1?ie=UTF8&qid=1483117475&sr=8-1&keywords=programming+principles+and+practice+using+c
Definitely has helped me a ton.