Inteligência Artificial destruindo no dinossauro da Google! (Rede Neural)

4.37M views1239 WordsCopy TextShare
Universo Programado
Seja muito bem vindo ao Universo Programado! Neste vídeo você verá como a Inteligência Artificial ...
Video Transcript:
Hello and welcome to Universo Programado I'm Victor Dias and in this video we will create an AI that plays the google game So if you like this kind of content don't forget to subscribe and leave a comment on which games would you like to see an AI play For those who don't know, the game is simple You have to dodge obstacles playing as a dinosaur by either jumping or ducking and the objective is to get points by getting the farthest as possible If you use Google Chrome you can play by pasting this link But before we start I will give you a brief explanation on how does the AI work: The algorithm is called Neural Network It tries to mimic the human brain This colored chart that you see is like their brain The first step is to give it infomations like for example the distance of the next obstacle The height of the next obstacle and the game speed We will get these informations and take them to the neurons which are these 4 black squares But before these informations get to the neurons they are multiplied by a number that are inside the circles Each circle is a number that has a variation between -1000 and 1000 Usually these numbers are called "weights" (its function is to increase or decrease the signal that we are multiplying) If for example the information is multiplied by 1000 it will increase a lot and -1000 it will decrease a lot. The function of the neuron is really simple: It will get the multiplied information and add them, then will verify if the result is positive. If it's positive it will forward the information If it's negative it will emit a 0, in other words, it's nullified Then in the last neurons if it's a positive number that action will be executed.
If the result is negative It will be turned into a 0 and the action will not be executed. In other words if the "jump" neuron emits a positive signal the dinosaur will jump if it emits a 0 it won't Lets see an example to be easier to learn it Imagine if the dinosaur is at a distance of 200 pixels,15 pixels of height and 8 game speed of the cactus We will get all this information and deliver to the input layer 200, 15, 8 will progapate through their respectives weights then the neurons will add the values and will verify the result, if its bigger than 0 it will trigger, if not its nullified. By the end the action that has the value bigger than 0 will be executed.
You've noticed that the weights define the behaviour of the dinosaur. The weights are responsible for associating the situation that the dinosaur is in and the action it will do. But the problem is that we don't know the exact number of each of the weights They can vary between -1000 and 1000 There are countless combinations of weights For this reason we can't try each one of them to see which is best.
But, we can elaborate an estrategy to find the best combination of values that results in a dinosaur that's good on playing the game. That will jump and duck at the right time. So what strategy we can use to find the sets of values?
To be able to find the correct values is really simple: The first thing we need to do is to create a ton of dinosaurs with random values then let them play the game to see how far they can get. When they all die we look for the one who ran farthest It will probably be the best of them Then we will clone it so all dinosaurs is its exact copy The same value of all the weights then we will make random slight modifications to have the chance of a slightly better dinosaur. Now we repeat the proccess and let them play again until we have a good specimen I tried to recreate the game as close to the real as possible, like the speed the dinosaur falls, the speed of the jump, etc.
This chart show us the distance of each generation the blue line represents the distance of the best dinosaur of the current generation and the red line represents the average of all dinosaurs of the current generation On the right side we can see the neural network of the best dinosaur that's still alive of the current generation The neurons are circles and the weights the lines. The technical details of the implementation I will leave in the description. After training for a while it got this score From now on it won't die because they learned how to dodge every obstacle At this point I got disappointed because I thought they wouldn't learn so fast.
So how can we make it harder? I added a line of spikes at every 5000 pixels To be able to get through the spikes the dinosaurs received a little airplane! The little airplane floats for the same amount distance of the line of spikes So they can't use the airplane and still fail to go through the spikes but there's a detail The airplane has a 4000 pixel cooldown It's the distance, when it moves 4000 pixels it will be able to use the airplane again Why?
What's the idea behind it? The idea behind is to use the airplane sparingly only when it's necessary To be able to use it when the line of spikes is right in front of them They will have the airplane available but we want them to use it in the right time This is the proof that they recognized the spikes and will only use the airplane to avoid death, that they are not using randomly. But surprisingly they've learned it too but not so easily though And there's infinity again.
. . It will never stop.
. . Well, we have to make it harder.
The idea is to accelerate the game slowly but permanentely You can see that the speed caps at 8. Because that's how the original game does. the speed stops growing at a certain number.
So now we will let the speed grow indefinitely At some point the AI will lose An hour later. . .
Two hours later. . .
Three hours later. . .
Two thousand years later. . .
Well they couldn't play forever, but something surprised me, a LOT. It found something that I didn't intend to be possible And also used it to get an advantage. I will show it on a duel between me and the AI *Just between you and me, I was humiliated* I'm the yellow dinosaur.
1, 2 , let's go FAIL! Their reaction time is infinitely above mine ♫ Hello darkness my old friend ♫ TURN DOWN FOR WHAT! The game was so fast that they could jump instead of using the airplane So why is it best to jump instead of using the airplane?
Because of the reaction time: When the airplane is used they are stuck and unable to press down to fall faster while jumping they can control the fall speed Probably during training the dinosaurs that jumped instead of using the airplane got farthest So that's it! If you liked don't forget to like and share with your friends also many thanks for your attention.
Copyright © 2024. Made with ♥ in London by YTScribe.com