AI Learns to play Snake!

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

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

  • @chaoseclipse0121
    @chaoseclipse0121 3 года назад +134

    If you listen closely, you can hear Code Bullet wailing and having an aneurism off in the distance.

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

      @Dario Roman How and in what way does your shilling have ANY relevance to either this video or my comment on the suffering of a specific programmer? I'll give you a hint: it has none.
      Also a trick: Piracy is not only wrong, it's unlawful. You shouldn't be shilling that shit site, or any others like it for that matter.

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

      @Kaiser Felipe Another account, another report. Keep them coming, I enjoy shitting in your cheerios when you think it's a good idea to try to advertise in my comments, especially with a piracy site. Quit being a basement dweller and and actually buy shit. You might find you might help the economy a little.

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

      @@chaoseclipse0121 hahahah its cute that you think your two reports will actually bring his chanel down , the kid is not only learning and applying knowlege but also make the effort to teach others . While u practice how to make multiple gmail accounts to report ppl he is probably learning more ai stuff. I would suggest u learn how to code fand create a neural network to detect plagarism . Probs ask @
      Chrispresso to teach u how to make one , cause the extend of knowledge is very limited

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

      @@iam_devansh Riiiiiight, all this coming from someone who can't be bothered to spend an extra minute or two to use proper grammar and spelling, on top of praising a moron who uses a bot to advertise a PIRACY website and then having the gall to tell me to learn something from criminal scumbags while lacking the willpower to type properly on the internet. I wouldn't be surprised in the lightest if you're the same person who owns the other two accounts, then turning around and giving yourself praise while thinking you're telling people off who challenge or insult you, because there's nothing praiseworthy of your typing skills and your praise of criminals.
      You should sit down and seriously consider your life choices. I again reiterate that piracy is not only wrong, it's unlawful. It will come back to bite you in the ass one of these days, and no VPN will protect you when you come under investigation as VPN's are required by law to turn over data and logs when it comes to criminal investigations. The fact you're logged into an account and making posts leaves your IP linked to your account removes whatever "safety" you think you have.

    • @moonblaze2713
      @moonblaze2713 3 года назад +7

      @@iam_devansh I cant see who the OP is talking to. Seems his posts got deleted. Maybe he did that himself, or maybe you're wrong and his account got deleted.
      Just thought youd like to know.

  • @bbuerk9193
    @bbuerk9193 4 года назад +63

    Starting the ai in a small area was definitely the key to its success. I have seen a few of these snake ai’s and they always struggle with avoiding their own tail. By putting the ai in a small area, you’re forcing it to deal with the lack of space early on and it overcomes the problem much better.

  • @burakverid646
    @burakverid646 3 года назад +29

    I especially appreaciate the part where you explained the input nodes. Most of the videos are missing that part.

  • @marufranco5281
    @marufranco5281 5 лет назад +277

    This is the first Snake AI simulation that actually finishes the game

    • @luigisgl2639
      @luigisgl2639 4 года назад +14

      It is because it is the first one to use multiple hidden layers.

    • @Technodog
      @Technodog 3 года назад +4

      Probably because the person who made spent a lot longer actually training it rather than just a a couple hours or a day

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

      There's no time or step constraints.

    • @williamluong7743
      @williamluong7743 3 года назад +4

      @@luigisgl2639 the problem is though, it's not very fast. It just goes in a pre-defined pattern which is safe, but terribly inefficient

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

      @@williamluong7743 yes. Couldn't a dumb algo be written that goes top to one row from the bottom, up and down moving right by one colum each time then taking the bottom row back to the left most colum and starting again? That would always win wouldn't it? It would also always win on the same squarebottom left one row up.

  • @AndrewMakesPuns
    @AndrewMakesPuns 3 года назад +21

    I have never felt so outsmarted by a snake in my life,
    Also maybe give the snakes a reward for being quicker to each apple to encourage a speedier strategy for larger grids

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

      It needs to be scaled to the current length though, since more efficient pathing is OK when short, but longer snakes actually need to zigzag to "store" that length so it won't unalive itself

  • @GreerViau
    @GreerViau 10 дней назад

    Awesome job! The technique of starting it in a small environment to learn that strategy, then bringing it to full scale was really smart! Also a really good loss function. Great vid, keep it up!

  • @idr7789
    @idr7789 4 года назад +43

    this is THE most underrated video and channel on RUclips.

    • @Chrispresso
      @Chrispresso  4 года назад +4

      Glad you enjoy it :) I'm working on more as well, and if you have ideas for AI's or games you want to see, I'm open to suggestions.

    • @idr7789
      @idr7789 4 года назад +5

      Sure! How about a Deep Learning algorithm to play Tetris?

    • @Chrispresso
      @Chrispresso  4 года назад +2

      @@idr7789 I will definitely look into this to see what I can come up with!

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

      there are even more

  • @smilingx4-189
    @smilingx4-189 4 года назад +1

    You are the first one one that i seen making a Snake AI that is not failing or using tricks to finish the game bravo

  • @williamdowling7718
    @williamdowling7718 3 года назад +4

    It would be really interesting to take the genetic makeup that succeeded in winning the game and training it with a fitness function that prioritizes speed/effeciency and then try again on the large grids.
    Awesome vid.

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

    Me : nothing scares me, but those blue red lines, those scares me

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

    Back in the 80s there was a multiplayer version of Snake for the Commodore 64 which was a type-in game in RUN Magazine, although the setup was that each snake would have a rule set for which direction to move given the surrounding 8 cells, and the point of the game was to program your snake with a rule set that made it outlast all the other snakes. Being the kind of nerdy kid I was I decided to see what happened if I randomly combined the rule sets of the two best-performing snakes, basically coming up with genetic algorithms on my own, and it got pretty good... then I let it also use the human player’s rule sets, and it got scary good.
    So anyway I appreciate this video.

  • @xordux7
    @xordux7 4 года назад +4

    I just now read your blog and implementation...great work man!

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

    nice job man! it was harder than I thought making the representation. Really clever solution getting the direction account so that the snake knows that when the head goes to where the tail is currently it will not crash into itself :)

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

      Thanks :) Glad you appreciated it!

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

    i Love these AI Channels they're always so Fun to watch

  • @maxbas2018
    @maxbas2018 4 года назад +1

    This video was (or more will be, dont have the time today) so helpfull improving my NEAT. I only had a Highscore of about 4-5 in Generation 3300
    I thank you really much

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

    AI is so cool, it's amazing how many applications it has and how easily accessible it is for people.

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

      Yep! I'm hoping to continue to show how and where it can be used. I know AI is a hot term these days, but I think understanding it and showing it in games makes it a lot more relatable for people.

  • @happygood18
    @happygood18 4 года назад +4

    Wow, man. You and your brilliant snake did well. make ai on more complex games!

    • @Chrispresso
      @Chrispresso  4 года назад +1

      Glad you enjoyed :) Definitely working on some, just need to find some more time. I'm also open to suggestions if you have any games in mind!

    • @krishna1.097
      @krishna1.097 4 года назад +1

      😏

  • @xhargh
    @xhargh 5 лет назад +107

    Nice! I wonder how they would behave if there were two or more snakes competing for the same apples.

    • @Chrispresso
      @Chrispresso  5 лет назад +43

      It would definitely make it so the more aggressive snake would get some of the early apples. I'm not sure how it would change the population once the snakes got to a larger size. I might have to test it out!

    • @xhargh
      @xhargh 5 лет назад +10

      Chrispresso I would guess that some snakes will try to kill its opponent(s) to be able to get more apples.

    • @Takumi-San
      @Takumi-San 5 лет назад +10

      @@xhargh well, trying to kill its opponent means that generation has failed. Similarly, the 'victim' generation would learn that dying by attack is a bad idea. I reckon the game would tend toward a scenario whereby both snakes survive for a maximum time by unintentionally collaborating to maximise each one's own chance of getting an apple.

    • @xhargh
      @xhargh 5 лет назад +3

      @@Takumi-San might be so, it could also depend on whether it is one kind of snake or different kinds of snakes competing.

    • @heromaxone2993
      @heromaxone2993 4 года назад +4

      I think the snakes would learn to cooperate

  • @investidorsortudo4028
    @investidorsortudo4028 5 лет назад +5

    And...It is fantastic! congrats!

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

    It was beautiful to watch! Well done

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

    Amazing, the AI discovered that the brute force approach is in fact the best approach. That kind of generalization is pretty crazy.

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

      I agree! I think it's pretty amazing that an AI was able to learn to "play it safe" to win

  • @wm7894
    @wm7894 3 года назад +10

    I just love these AI videos!! But may i request something? I notice a lot of people usually remake the games, and then trains an AI to it. And here it appeared as if you gave the snake eyes, but when humans play, they look at the whole map. So then, could you try sometime to make an learning AI to an original game, that reads the screen as a human but hopefully doesn't run too slow because of the image it has to process?
    Either way im definitelly looking forward to more videos in the future!

    • @Chrispresso
      @Chrispresso  3 года назад +9

      Yep! This is actually my plan. I know I'm currently slow at making videos but hopefully I pick up the speed this year. I've got a lot planned, so fingers crossed. I just wanted to start the AI intro slow by first showing how to use a neural network + genetic algorithm on something like a game I made replicating snake. Then I made it more advanced by doing the same thing with car evolution and then having it play a game that I didn't change (super mario bros). Recently I made it learn grid world by just using pixels from the screen. So next up is combining some of these techniques ;) My plan was to add AI ideas slowly so that people can always just watch the "AI Learns" series in order to see how to add different components, or to skip around and find an AI solution they might like.

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

      @@Chrispresso could you please try and give TIME a high weight in the fitness of a snake. It will be nice to see what new strategies they come up with to win the game quickly.

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

      it would be slither.io then

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

    But what about efficiency?
    The snake AI : we don't do that here!!

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

      Yeah, not only was it totally inefficient but I could code a routine to do it this way in about 20 seconds.

  • @limaedugabriel
    @limaedugabriel 4 года назад

    Absolutely incredible. Amazing video, my congratulations!

  • @Adalast
    @Adalast 5 лет назад +17

    I'm actually kinda curious how the later generations would handle non-rectangular arenas or obstacles.

    • @Chrispresso
      @Chrispresso  5 лет назад +10

      I would have to adjust the code a little bit, but it could handle small obstacles if I did. The main issue is if I add something quite large and keep the code as is, the snake will see an obstacle and treat it as a wall. So it would never know the difference between obstacles and walls. For something more sophisticated I could use deep Q-Learning to allow it to learn obstacle avoidance!

    • @Adalast
      @Adalast 5 лет назад +2

      @@Chrispresso that would be so awesome.

  • @hoangminh6899
    @hoangminh6899 4 года назад

    You are the best, Gratz Chrispresso

  • @scottbigbrain3944
    @scottbigbrain3944 4 года назад +4

    Dude, this is just straight up awesome. I need to do more of this stuff on my channel. I don't get exactly how the binary sensing works though.

    • @Chrispresso
      @Chrispresso  4 года назад +1

      Glad you like it! Binary sensing is just a simple yes or no (1 or 0) fed into the network. Either it sees a particular object or it doesn't.

    • @scottbigbrain3944
      @scottbigbrain3944 4 года назад

      ​@@Chrispresso Thanks for answering my question. So, the binary sensing that you set up doesn't give any distance information? If so, its scary impressive that you were able to get that to work with the binary sensing.

    • @Chrispresso
      @Chrispresso  4 года назад

      @@scottbigbrain3944 That's correct. I trained with both types to see what would happen and that's what is shown in the graphs. I was impressed that something as simple as binary sensing was able to solve it.

  • @billwhoever2830
    @billwhoever2830 4 года назад +3

    the best ai learning video I have watched so far, nice job!
    darn those 2 dislikes :V

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

    This stuff is so amazing. It learned - and then taught me - that the best algorithm is to stack itself in neat columns with patience to find the apple. Actually by the end it has learned to just scan vertically until it happens to find the apple and then is biased to return to an average scanning position at the top left of the domain.
    It would be interesting to introduce a decaying apple that requires finding before disappearing because the snake needs to "eat". I'd guess that the most interesting behaviors could be developed by specifying the snake find the apple in X moves to stay alive + grow and if >X moves grows but loses energy and needs to find the next apple sooner or else die.
    Nevertheless, incredible.

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

      The problem with something like that is that at a certain point the lowest possible time to get to an apple would be greater than the rate at which the apples decay so it would get stuck around a certain score

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

      @@ultraeon there could some intermediate window where can be true, depending on the setup. Interesting observation.
      At high lengths, the AI has more opportunity to "snake" which increases time required to get the apple, on average. There's a maximum length snake that is playable assuming perfect reaction time. I wonder how fast time-stressed vs. lazy populations would converge to the maximally efficient solution at the boundary of playability. If you notice, some of the mid-gens in this video get lazy and make less efficient and more numerous moves (shorter length requiring sooner changes in direction) until converging on the ultimate snake which is necessarily the most efficient use of 2D (3 point max. direction choices) moves (linear paralleling with minimized lengths of direction changes).

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

    It basically set a hamiltonian cycle for itself

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

      Yep! I was pretty impressed it figured it out.

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

    It's incredible how the names of all the components have changed till the 90ies yet they do exactly the same as they did back then....example: one-hot-encoded -> winner-takes-all (WTA)

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

    I can say this snake has smart moves

  • @stefanleustean4253
    @stefanleustean4253 4 года назад

    best snake ai, no cap

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

    What in the..... Your AI figured out the best way to beat snake (aka Hamiltonian cycle) in just a few hundred generations. That's miraculous lol

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

    Snake evolves into Ouroboros.

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

    Great work!

  • @gliderguld
    @gliderguld 4 года назад +2

    Great demo. Would it be possible to do "brain surgeory" on one of last snakes in order to see how changeing vision changes output and maybe make an interpretation of nodes in the hidden layers?

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

    The first thing I see here is that the snake ended up following a hamilton cycle. It could be faster, too. Very interesting

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

    The computer is playing with itself.... give it some privacy! oO

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

    That's the pattern I use for playing snake as well, but since there are no walls in the snake I play, you can zigzag one point and instead of 3 movements narrow it down to 2 movements and just go through the ceiling and come out the floor.
    This Ai should had a time limit/reward to force it into risking it for the reward or playing it safe, OR playing risky early on and safe later when space got cramped.

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

    Anyone who reads this, don't just watch a video and forget about it, give the creator some support for once

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

    Thank you. The great one. Some questions: (1) Is there any reasoning behind the NN architecture (number of layers, number of neurons in the layer) choice? (2) What if we change all directions from absolute (U,D,LR) to relative to current head direction; wouldn't it help? (3) Why do you need crossovers; you anyway do mutation, what's the difference either to mutate the best or mix of two best?

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

    Constantine 1453😂😂😂

  • @jeeptransport-tutorials7761
    @jeeptransport-tutorials7761 Год назад

    8:30 Looks like its starting to play Snake as if it was a printer lol. Especially 3D one :P

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

    That was the pattern I used back in 1999 to play snake till maxed out (managed that 3 times)

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

    Amazing!! I am speechless!!

  • @itzik009
    @itzik009 4 года назад

    Awesome video!
    Thank you for your insights 😊

  • @mcolsenet
    @mcolsenet 4 года назад

    what a great work. well done

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

    I like how the goal of this game is to create an ouroboros

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

    Thank you! Great explaination!

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

    This is very impressive. Improvements that I would like would be that the neural network can 'explain' or 'formulate' somehow how to play snake. Ofcourse not in a conscious way and not in a normal human language. Just that it would give us the basic concepts of its success. I believe we could achieve this by letting us be inspired again by the human brain. Those connections are not meaningless calculations. Every connection has a small meaning and together they form a bigger meaning. We already know the meaning of the inputs of our artificial neural networks, and we know the meaning of the outputs. Let search for the meaning of what's in between them.

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

      This is definitely possible and usually involves a heatmap to see what is "hot" and "cold" for the AI. That concept can help a lot when working with other types of networks too such as CNN's.

  • @lmpablo
    @lmpablo 4 года назад

    Thanks for your video! That's so good, congratulations

  • @PraYogiz
    @PraYogiz 4 года назад

    Great job man!

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

    So; it figured out hamiltonian on its own.

  • @JD-rv7wn
    @JD-rv7wn 5 лет назад +7

    Distracted by great music ;__;

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

    i wonder if its possible for it to learn that once the snake takes up half of the map, it should stay as close to its body as possible(otherwise it spends a increasing amount of time navigating) maybe something like "the closer it is to its body, the more likely it is to stay close to itself" which would work like "as the map fills up with its body, the weight of an input increases, once the map is 50% filled, the input is at 50% and then becomes active, triggering a change in the model. This would take forever to train normally, but if you start the snake in a map that is 49% full it wouldnt take long before the new part triggers so it could be tested and mutated quickly. it would also need to be able to keep functioning or it would die before it got to that 50%.

  • @V_Robot
    @V_Robot 4 года назад

    Love this video OMG best A.I. snake explanation

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

    Well its been a year since i saw this and im happy to be your 999th subscriber

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

      Awesome! Thanks for the support :D

  • @SrikanthReddy-nx4px
    @SrikanthReddy-nx4px 4 года назад +1

    Its awesome man

  • @ikoLinh
    @ikoLinh 7 дней назад +1

    Una pregunta, la fruta se genera en una posición aleatoria(sin ser la actual, cabeza o cuerpo ) o se genera en una posición alcanzable?

  • @MultiNeurons
    @MultiNeurons 8 месяцев назад

    Wonderful! Hope I can do things like these but using SNN

  • @tedro7870
    @tedro7870 4 года назад

    Nice work!

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

    Interesting, the latest iteration on the huge grid appears somewhat close to an optimal strategy.

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

    Underrated

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

    Awesome! I think you should put a metric to decrease unnecessary movements, it will increase snake's efficiency.

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

    Sick it actually won!

  • @simonstrandgaard5503
    @simonstrandgaard5503 5 лет назад

    Nice video. Thanks for sharing your code. I'm working on my own snake game.

    • @Chrispresso
      @Chrispresso  5 лет назад

      Of course! Glad you liked it. Any project I post will always contain source, just FYI :)

  • @devraan
    @devraan 4 года назад

    I wish the snakes were able to further develop themselves to be more efficient on using time

  • @appc23
    @appc23 4 года назад

    It would probably be harder to apply that strategy to odd grid sizes maybe

  • @borat6363
    @borat6363 4 года назад +1

    Could you next run a simulation using the best-performing snake to prune the number of neurons needed? Would love to see what the minimum number of neurons is to accomplish this game, since simple driving games only need 1 hidden layer of 3 (!) neurons.

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

      Simple driving games might not even need any hidden node, since they basically use linear PIDs
      This is much more complex, especially at longer length, and without making directions relative to head

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

    This was amazing.

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

    2:30 these powers like 2.1, 1.2 and 1.3 seems to be overengineering

  • @pnsakanjankumar
    @pnsakanjankumar 5 лет назад +1

    Great video

  • @jerryjohn1995
    @jerryjohn1995 4 года назад

    The end was like watching a thrilling movie?

  • @elheffe80
    @elheffe80 5 лет назад

    Unexpected awesome sauce!

  • @WarriorX16
    @WarriorX16 5 лет назад +1

    This is so cool!

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

    Hi, great job!
    I have a question: how did you come up to this fitness function?

  • @davi84mn
    @davi84mn 4 года назад +1

    try to change the fitness function givin reward inversely related the duration. like reward=(LENGTH-TIME), it should develop a more interesting behavior

    • @farenhite4329
      @farenhite4329 4 года назад +1

      Must be a small penalty or early snakes will instantly die to minimise time.

  • @Arunkumar-ri2zw
    @Arunkumar-ri2zw 4 года назад

    Great awesome.. Could train AI to play slide puzzle with 3x3, 4x4,.. I love to see that evolution on playing... 😍😍😍

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

    wow Congrats !

  • @1.8millionvolts87
    @1.8millionvolts87 4 года назад +1

    Subbed

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

    What a great video!! :O :')

  • @iamlegend3927
    @iamlegend3927 5 лет назад +2

    Hi! Cool video :) would you be interested in making an AI for other games? For example agario. It may seem to be a really simple game but it really is not. Every player controls a 'cell' and the goal is to eat other players and, by doing so, gain cell mass and end up being the biggest cells. I'm thinking of coding an AI for a simpler version of agario, since I'm just a beginner, but maybe you can have a try!

    • @curiously-cinnamon
      @curiously-cinnamon 3 года назад

      One important factor you must consider along with the basic abilities each cell has is "mass loss". This occurs continuously, so if you are just roaming around without eating, your mass actually starts to decrease. That changes the strategy i think

  • @acker5295
    @acker5295 4 года назад

    Amazing! I'm curious if the best snake can always finish the game? Is there an apple sequence fails it?

  • @PaxiKaksi
    @PaxiKaksi 5 лет назад +1

    It was simply amazing

  • @rafaelterra1687
    @rafaelterra1687 5 лет назад +1

    Amazing!

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

    Fascinating! Didn't that bigger board bear the same issue Code-Bullet ran into?

  • @vulnoryx
    @vulnoryx 4 года назад

    Nice one

  • @mysteriousboi1019
    @mysteriousboi1019 4 года назад

    Impressive!

  • @astro22
    @astro22 5 лет назад +1

    amazing!

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

    It follows the simple and obvious Hamiltonian pattern which guarantees not running over the tail and being able to run through every node but it’s really inefficient. I was hoping to see something smarter. Perhaps more middle layers and more generations would make it smarter. Choosing the inputs and output and the encoding can be crucial to the smartness you get out of it.

  • @7ekaya
    @7ekaya 4 года назад +1

    The PERFECT ONE I was looking for...😃😃😃😲😲😲😲😲

  • @Ayan-i6q9q
    @Ayan-i6q9q 2 года назад

    IT WOULD BE MIRACLE IF AI LEARNS TO PLAY *AMONG US!*

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

    Would have been a greater video with speech!

  • @MrJdsenior
    @MrJdsenior 5 лет назад

    That is very cool. There seems to be some initial "weirdness" going on early in the learning process with search patterns. In the beginning was it just trying to find the envelope of the playing area, or did it already know that? If so, why was it just going semi randomly across from side to side without (apparently, by its actions) even acknowledging the apple's location? I guess what I'm asking is does it have to randomly "hit" an apple once before it even "knows" there is reward in that, or is it instructed from the beginning that getting each apple is a large part of the goal? Enjoyed it, even though I'm not at all sure I really understood what was going on.

    • @Chrispresso
      @Chrispresso  5 лет назад

      Glad you enjoyed! The snakes have no idea how large the space is that they are in. In the beginning they are just randomly initialized and they don't know what an apple is. If the weights of the Neural Network result in them getting an apple, they are rewarded, but not until the end of their play. So they don't have an immediate feedback saying "oh, that thing I just grabbed was good". I plan to do more videos similar to this, so I'll try to improve how I explain things in the future!

    • @MrJdsenior
      @MrJdsenior 5 лет назад

      @@Chrispresso Got it, makes sense now. "They" really did get the hang of it, didn't they? ;-) I'll watch for your further videos. I remember sitting beside a couple of really early neural net guys decades ago talking about training the algos using ground truthing and sims, didn't have a clue what they were talking about then, either. Guess it's a good thing I was a HW guy...couldn't run "your stuff" without "our stuff", though, could you?

  • @sankethb.k642
    @sankethb.k642 4 года назад

    That was great. Even i want to build something like this, can you please tell which frameworks you are using for NN and genetic algorithms

    • @Chrispresso
      @Chrispresso  4 года назад +2

      Thanks! I actually created my own simple frameworks for them. You can check out the code on my GitHub if you're curious how it works: github.com/Chrispresso/SnakeAI

  • @burhanhassan9805
    @burhanhassan9805 4 года назад

    Surreal!

  • @damarcones
    @damarcones 5 лет назад

    Nice job!!!!

  • @bjarneschmitz5160
    @bjarneschmitz5160 5 лет назад

    Very Good Video! Helps a lot !!
    But i dont get it with the Hot encoded Variables
    So they is always one active but when is which active?

    • @Chrispresso
      @Chrispresso  4 года назад

      Glad you enjoy it! One-hot encoded variables make it so you can give equal weight to different things. Since the inputs are multiplied by weights, using a one-hot encoded variable allows the AI to learn which input matters without giving bias toward one over the other.

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

    Excellent video. I can't get my snakes to avoid the wall. What am I missing? Do you use elitism as well?

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

      Yes I do!

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

      @@Chrispresso What proportion of snakes in the next generation are just randomly spawned, if any? Or are these snakes all derived from the previous generation through elitism, crossover, mutation etc?