Python + PyTorch + Pygame Reinforcement Learning - Train an AI to Play Snake

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

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

  • @edwintjoa6099
    @edwintjoa6099 Год назад +20

    Thanks for the awesome video! Really fun to see agent improving during the games.

  • @HRDmonk
    @HRDmonk Год назад +9

    Thank you so much for this tutorial. I have always wanted to introduce snake with ML. and now looking forward to learning more about pytorch

  • @khalidelgazzar
    @khalidelgazzar Год назад +14

    Watched the first 4 mins and the game and the learning process is fantastic! 🎉 Will go on it with the rest hopefully soon.

  • @mihailmihaylov988
    @mihailmihaylov988 Год назад +102

    A nice video. My only critique is that the presenter kept writing code for almost an hour without running it. That's not giving a good example.

    • @JohnyGuitar-t8e
      @JohnyGuitar-t8e 10 месяцев назад +4

      Need to be patient 😊

    • @DroopTheSnoot
      @DroopTheSnoot 10 месяцев назад +19

      Debugging code should always be done every function or so

    • @pedroklain9375
      @pedroklain9375 9 месяцев назад +11

      Bro is just too good at coding, he runs it in his head 😂

    • @mihailmihaylov988
      @mihailmihaylov988 8 месяцев назад +17

      @@pedroklain9375 It's not about what he can do or cannot do. It's about what example he sets. After all, this is an instructional video.

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

      friend ai and programming code is a bit different
      @@mihailmihaylov988

  • @adrian46647
    @adrian46647 9 месяцев назад +2

    Awesome, so hard to find that type of explanation of dqn. All clear, great balance between theory and coding part for beginners in rl.

  • @dabyttamusic7308
    @dabyttamusic7308 Год назад +29

    Super great video! I run it and after more than 2000 games it seems that the average score reached a plateau of 30. It Avoids boundaries very well. But it hit itself when the tail is too long. But this movement should be predicted before.

    • @ИгнатовБорис
      @ИгнатовБорис Год назад +25

      To avoid the self collision we have to add snake parts positions to the game state somehow, in the current model it doesn't know where's the body so it will never learn how to avoid it

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      @@ИгнатовБорисThat makes so much sense! I imagine for it to learn about self-collision without that it would require a much larger net and have to use some form of memorization, which could take forever

  • @murtazabadshah8747
    @murtazabadshah8747 8 месяцев назад +20

    Everyone's commenting that its an excellent video but IMO this tutorial is awe-full! The instructor does not explain the process, hes all over the place going back and forth and just rushes through the concepts. If you want to blindly follow an online tutorial watch this video, if you want to actually learn the concept I would look somewhere else....

    • @ttganglia
      @ttganglia 7 месяцев назад +1

      Exactly.

    • @ShtBall5
      @ShtBall5 7 месяцев назад

      any video recommendations ?

    • @ttganglia
      @ttganglia 7 месяцев назад

      @@ShtBall5 You can check this video:
      "Learn Pytorch for deep learning in a day. Literally."

    • @murtazabadshah8747
      @murtazabadshah8747 7 месяцев назад

      @@ShtBall5 Yeah I ended up watching this video that helped me a lot to understand the basic concept of the Q-learning algorithm and the basic concept of how the state and agent work ruclips.net/video/pqxyDU3ftcs/видео.html&ab_channel=Bits%26Neurons

    • @Singh_Sahdev
      @Singh_Sahdev 7 месяцев назад

      Some WHERE else??

  • @techarchsefa
    @techarchsefa 9 месяцев назад +3

    That is so smooth bro, thanks

  • @veronicasalazarpereira9933
    @veronicasalazarpereira9933 Год назад +3

    I did it!!! Thanks for showing this.

  • @cadewzan
    @cadewzan Год назад +9

    Theres no need of waiting a lot of time to train, on the game script you can just change the varaible from 30 to 1000 so snake goes much more fast and trains intself on less time.

  • @Hiyori___
    @Hiyori___ Год назад +23

    Very interesting tutorial. I was familiar with Snake code implementations, Tensorflow basics and RL principles and I could follow along. For some reason the plot doesn't appear, and I only get a small blank window where the plot should be. Probably some bug while typing the code down.
    Other than that everything works for me.
    Thank you very much!

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

      just incase anyone else has this problem, you need at add plt.pause(.1) to the bottom of the plot function

    • @stillrunning9841
      @stillrunning9841 11 месяцев назад +3

      Hey there, same happened for me!
      Did you find the error? I'm still trying to find it :)

    • @lillymoreau7721
      @lillymoreau7721 11 месяцев назад

      @@stillrunning9841 this code worked for me: import matplotlib.pyplot as plt
      plt.ion()
      def plot(scores, mean_scores):
      plt.clf() # Clear the current figure
      plt.title('Training...')
      plt.xlabel('Number of Games')
      plt.ylabel('Score')
      plt.plot(scores, label='Scores')
      plt.plot(mean_scores, label='Mean Scores')
      plt.ylim(ymin=0)
      if scores:
      plt.text(len(scores)-1, scores[-1], str(scores[-1]))
      if mean_scores:
      plt.text(len(mean_scores)-1, mean_scores[-1], str(mean_scores[-1]))
      plt.legend()
      plt.draw()
      plt.pause(0.1)

    • @radiatian4908
      @radiatian4908 11 месяцев назад +8

      Super late reply, but i had this issue and it turns out the video is missing two lines of code. In his files he also has
      plt.show(block=False)
      plt.pause(.1)
      as the last two lines.
      Hope this works for u too

    • @niklaskohler3242
      @niklaskohler3242 6 месяцев назад

      @@radiatian4908 Thank you very much!

  • @JohnyGuitar-t8e
    @JohnyGuitar-t8e 10 месяцев назад +2

    A video as valuable as a playbook👍🏻👍🏻👍🏻

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

    Excited to try this!

  • @Fr4nk4000
    @Fr4nk4000 2 года назад +5

    Following this since I wanna make a pygame project of mine that I poured a lot of time into and have no idea what to make the game about play itself. Wish me luck.

    • @jaibhagat7441
      @jaibhagat7441 8 месяцев назад +1

      have you made something

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      If you haven't already made something, how about a driving game? You can use checkpoints to iterate as a list, and that can easily be used for RL training.

  •  2 года назад +5

    Always very high quality videos when I just need it :) Thanks a lot! Looking forward to finish the video 😎

  • @aliengineroglu8875
    @aliengineroglu8875 Год назад +8

    Thank you for your great work. I couldn’t understand the equation you created in the video about the simplified Bellman equation, Q_new = reward + gamma * torch.max(model(next_state)). In this equation, model(nextstate) gives us a probabilistic action prediction. I couldn’t understand why we added one of the action probabilities to the reward. This is totaly different than the Bellman Equation. I would be very happy if someone could explain how the original Bellman equation was simplified in this way. Thanks in advance to everyone.

    • @alanlam6302
      @alanlam6302 Год назад +2

      Same here. Appreciate if someone can provide a reference to this implementation

    • @wangking7427
      @wangking7427 9 месяцев назад +1

      The Liner_QNet model gives three actions' Q value vector . It's not the probablistic of each action but the QValue of each action. We take the action which has the highest QValue each step. The QValue in this tourtorial is the reward of the action.

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

    I’ve always wanted to do this, thanks alot for the tutorial

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

    Thanks for freeCodeCamp for making this possible.

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

    38:13 "It has to be [0,0,1]"

  • @stefanburger07
    @stefanburger07 2 года назад +19

    This might be a stupid question, but how would one go about saving this trained model and accessing it for further training?

    • @brayanfernandes371
      @brayanfernandes371 Год назад +3

      you can save the weights

    • @sanghoututorial3878
      @sanghoututorial3878 Год назад +4

      @@brayanfernandes371 how

    • @segovemoc4776
      @segovemoc4776 Год назад +2

      @Biglyp I actually wanted to ask a similar question. I save the weights and load them through: self.model.load_state_dict(torch.load(model_saved_path)) and it works, but the problem is that the snake is then underperforming. It learns then much quicker than before, but still it is significantly worse than during training.

    • @segovemoc4776
      @segovemoc4776 Год назад +9

      never mind. I found answer in the later comments - it is necessary to adjust the epsilon value to something very small after loading the model

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

      @@segovemoc4776 It works, but you need to set the Agent.n_of_games to something big value (eg.: 280).
      self.model.n_of_games = 280
      As you remember, there is exploration and exploitation in the get_action() function. We are updating the epsilon value using the self.n_of_games variable and then get a random number between 0 and 200. This line makes your snake so bad.

  • @Vedranation
    @Vedranation 4 месяца назад

    I did it and its so cool! Thank you so much

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

    Thanks for this video, I have solved all my doubts

  • @johnpap4237
    @johnpap4237 6 месяцев назад

    Perfect video!!Congrats! Is there any implementation with DDPG, PPO or SAC?

  • @dollarfree531
    @dollarfree531 2 года назад +2

    Very cool video! Highly useful!

  • @kevas777
    @kevas777 Год назад +2

    nice algo, but how to solve a problem with self destroy, when the closest cell to move is "inside body circle". I think a state must be all field with each body part,head, food etc, but its endless states and all of them unique and it will never learns or may be i wrong?

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

    Really nice!

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 2 года назад +2

      Look who is here, none other than mighty Radu sir🙏🏻

    • @Radu
      @Radu 2 года назад +1

      @@sidheshwartiwari9834 haha :-) funny!

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

    What to install before creating an environment ,iam confused

  • @devnull711
    @devnull711 Год назад +3

    Incredible work, thank you Patrick! PS: It is very funny to spot the typos/bugs before you do :)

  • @vespervenom2343
    @vespervenom2343 2 года назад +2

    I copied it code for code and it doesn’t work. It gives me no errors but just runs and then ends with no result🤦🏽‍♂️🤦🏽‍♂️🤦🏽‍♂️🤦🏽‍♂️🤦🏽‍♂️

  • @lukasgamedev
    @lukasgamedev Год назад +5

    Hello! Is there a way to save the state of the neural model? So I can load later a trained enemy AI, ready for being the player opponent? Thank you for the video!

    • @TanmayBhatgare
      @TanmayBhatgare 11 месяцев назад +3

      i think u can you torch.save(model.state_dict(), 'rl_model.pth') to save model and
      model = YourModel()
      model.load_state_dict(torch.load('rl_model.pth'))
      to load it. Hope this helps.

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      @@TanmayBhatgareSomeone else wrote to decrease the epsilon value after loading it so it can train more efficiently

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

    Really interesting course !

  • @enginturabk817
    @enginturabk817 5 месяцев назад

    In 38:30 part comment line of 138 is # right turn r -> d -> l -> u
    but line 141 is # left turn r->u->l->d
    should it be like this: # left turn l -> u -> r -> d ?
    or (written) r->u->l->d
    Please somebody explain it to me I do not understand

    • @sergioguzman1982
      @sergioguzman1982 2 месяца назад

      Idk what your exact question is, but to do a left turn assuming you are going right you have to go up, and to continue doing left turns you have to go left then down then right, then the cycle repeats it self.

  • @joe_hoeller_chicago
    @joe_hoeller_chicago 9 месяцев назад

    Cool vid 😊

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

    I think this project is awesome

  • @eugenmaljas7237
    @eugenmaljas7237 Год назад +3

    I want to modify the program: how do I make 4 outputs? I would like to integrate the snake length.

    • @arnavgupta8376
      @arnavgupta8376 Год назад +2

      I think you can do so if you change the line 20 ie
      'self.model = Linear_QNet(11, 1024, 3)' change the 3 to 4.
      and in line 90 'final_move = [0,0,0]' add another zero. Maybe there are some more things you need to do.

  • @sureshsingh9880
    @sureshsingh9880 7 месяцев назад

    Great content,,,❤❤❤

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

    This instructor is the best

  • @fatabi95
    @fatabi95 Месяц назад

    Thank you for this amazing tutorial!
    I encountered an 'Index out of bounds' error in model.py at line 59. Upon investigating, I noticed a difference between the code in the video and the code on GitHub. In the video, the line is written as "target[idx][torch.argmax(action).item()] = Q_new", whereas on GitHub, it's "target[idx][torch.argmax(action[idx]).item()] = Q_new".

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

    18:58 for me it is not showing as (pygame_env) ... ....
    i am a windows user
    (edit) it worked for
    I had to open a CMD outside of VS CODE
    and then follow the steps of conda pygame_env
    now I am getting "(pygame_env) C:\Users\........."

    • @bobjeff6779
      @bobjeff6779 8 месяцев назад +1

      how did you get it to say pygame_env

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

      @@bobjeff6779 when you are creating a venv (virtual environment) you can name it
      so to make venv with a different name you can do that by
      python -m venv myproject

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

    Brilliant 🔥🔥🔥🔥🔥🔥

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

    Very good video. I need help with the homework. How can you avoid the loops?

    • @Miyuru_
      @Miyuru_ 2 года назад +1

      same problem it's getting stuck in the same loop

    • @hcc3904
      @hcc3904 Год назад +18

      @@Miyuru_ overfitting... just add another condition point like if u dont eat apple in 10 seconds, minus -10 point

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      @@hcc3904I keep hearing of overfitting in RL, but I still don't understand what it means. Could I bother you for an explanation of this concept please, if it wouldn't be too much trouble.

    • @hcc3904
      @hcc3904 3 месяца назад +1

      ​@@fluffsquirrel just like memorizing instead of learning that what it means. There's 3 level of Learning. Underfitting, Optimal, Overfitting.
      Underfitting is means AI didn't learn much, as the name suggests. Kinda a kid trying hold the bottle but doesn't force enough so bottle fell and broke
      Optimal is the level that researchers and scientists want to reach and stay. In this stage, AI is learning good and still continues to learning. Kinda like that kid is holding bottle with good force and he can still learn how to pour it and tries for it.
      Overfitting is the stage of learning too much. In this stage you need to empty-off your AI's head by data dilution. For example
      imagine that the kid that i mention is holding the bottle and he can pour water excellently. but he cannot learn other ways to pour or holding the bottle. He need to hold a bottle with different mechanism, by using 3 of his fingers etc. so he can find another ways to learn.

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      @@hcc3904 That is an incredible example, thank you so much hcc! I really appreciate it, I've been struggling with this concept for years. Thank you so much!

  • @GenkiKuri
    @GenkiKuri 7 месяцев назад

    Awesome!!

  • @joekanaan2548
    @joekanaan2548 2 года назад +11

    Hi I have a question. I followed along and wrote everything. When I run it in the terminal it works but the plot doesn't. It gives me an empty minimized white screen. If someone else experienced this please help.

    • @AlexandruTunschi1
      @AlexandruTunschi1 2 года назад +14

      There are 2 lines missing:
      plt.show(block=False)
      plt.pause(.1)

    • @RANDOM_DUD-qj3jd
      @RANDOM_DUD-qj3jd 10 месяцев назад

      Where do these go?@@AlexandruTunschi1

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

    Great tutorial

  • @yavarjn2055
    @yavarjn2055 7 месяцев назад +8

    Lot of the code needs more explanation. There is a disconnect from theory and implementation. We copy all the parameters to this and to that without understanding why. The memory part is not well explained.

    • @ttganglia
      @ttganglia 7 месяцев назад +3

      Yeah. He isn't explaining, just repeating what he is writing.

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

    So far so good... but how about load the old 'brain' if u exit the game and want resume later ? Oo iam bite confused tryd with state
    if os.path.exists('model/model.pth'):
    self.model.load_state_dict(torch.load('model/model.pth'))
    self.model.eval()
    in the Agent init. but that dosent work

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

      did u find out a way to load the previously trained model?

    • @S3R43o3
      @S3R43o3 2 года назад +1

      @@vikramganesan nope sorry

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

      it seems like we need to remove the epsilon to load the model, otherwise it will keep doing random moves

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

      @@RORoMiguel You're right, it works for me :) thanks!
      first game : 33 score

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

      i think it doesn't work because you you wrote / instead of this\

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

    What's your VSCode theme? It looks gooood

  • @enginturabk817
    @enginturabk817 5 месяцев назад

    58:39 I dont understand #danger straight right left and 4 line codes :( please help me

  • @Ragnarok540
    @Ragnarok540 2 года назад +14

    My snake became self aware, any ideas to stop it from taking over the world?

    • @imthemainman
      @imthemainman 2 года назад +9

      😂😂😂😂😂
      Mine has hacked Russia, it's now impersonating Putin and is about to start world war 3.

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 2 года назад +2

      🤣

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 2 года назад +1

      @@imthemainman lmao 🤣🤣 i am drying 😂😂

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      @@sidheshwartiwari9834Hopefully you never got wet since 2 years ago!

    • @fluffsquirrel
      @fluffsquirrel 3 месяца назад

      Yeah! Implementation Ai safety guidelines such that the snake will respond "I'm sorry, but that violates the guidelines set by my creator" if someone prompts it to destroy the world. It's what OpenAi and Meta did

  • @AntonVasilev-q3t
    @AntonVasilev-q3t 11 месяцев назад

    thanks, intresting!

  • @googlyeyes3237
    @googlyeyes3237 2 года назад +8

    Can we speed up the game soo fast so ai can play faster and learn faster. Basically it can finish 100 games in a minute or two.

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 2 года назад +6

      Absolutely, you just have to increase the render rate. Good question though.

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

      it does that when it is drawing on the chart, I speed it up by making it only update the chart every 100 games.@@guillaumelotis530

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

      Just change the tick speed to make it a higher one. It is at the top of the script and is called "SPEED"

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

    thank you very much.

  • @vinayakbhandage8319
    @vinayakbhandage8319 2 года назад +1

    You never fail to amaze us✌

  • @canerunafraid9491
    @canerunafraid9491 Год назад +2

    The snake moves smoothly, but when it hits the first wall, the interface closes idk :/

    • @Lenslyfe
      @Lenslyfe 10 месяцев назад

      It's not meant to wrap. That's the correct behaviour.

    • @Sibixpur
      @Sibixpur 6 месяцев назад

      you can understand the code given right??

  • @luthermillamuculadosreisec3844

    Thank you

  • @pyshine_official
    @pyshine_official 2 года назад +1

    Nice effort and seems like the convergence is achieved upto some extent!

  • @Agesilas2
    @Agesilas2 11 месяцев назад +2

    set video speed at x1.25 or x1.5, thank me later.

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

    What about using GA to train the NN itself ? Will be a very interesting comparison no?

  • @bikeofdeath7656
    @bikeofdeath7656 3 месяца назад

    Thanks for the video but i would like to see more explaning on the go and less of Ctrl+C/Ctrl+V action.

  • @sunyog
    @sunyog 2 года назад +1

    What are the prerequisites of the video ?!

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

    so i had the program run over 2000 games and it couldn't get past the 80s mark. how would i get it to improve past that?

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

      there is no way to improve it unless you got coding knowledge

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

    how to perform UCB, optimal initial values and dynamic programming approaches in this model?

  • @kabrailchamoun8974
    @kabrailchamoun8974 2 года назад +1

    Could you bring us a crash course of blender (3d modelling program)?

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

      Python has nothing to do with 3d modeling though

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

      @@slamsandwich19 it is. Blender has a python library called pyblender. I am looking forward to a good blender tutorial and how to integrate this with python

  • @enginturabk817
    @enginturabk817 5 месяцев назад

    1:07:18 why did you write 80 ?????????????????????????? explain please

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

    thanks!

  • @cryptomoney6901
    @cryptomoney6901 2 года назад +18

    There is a small bug where the snake will eat itself if you go in the opposite direction that its going in. To prevent this from happening change this line of code:
    if event.type == pygame.KEYDOWN:
    if event.key == pygame.K_LEFT :
    self.direction = Direction.LEFT
    elif event.key == pygame.K_RIGHT :
    self.direction = Direction.RIGHT
    elif event.key == pygame.K_UP:
    self.direction = Direction.UP
    elif event.key == pygame.K_DOWN :
    self.direction = Direction.DOWN
    to:
    if event.type == pygame.KEYDOWN:
    # 2nd conditional to prevent snake from eating itself!
    if event.key == pygame.K_LEFT and self.direction != Direction.RIGHT:
    self.direction = Direction.LEFT
    elif event.key == pygame.K_RIGHT and self.direction != Direction.LEFT:
    self.direction = Direction.RIGHT
    elif event.key == pygame.K_UP and self.direction != Direction.DOWN:
    self.direction = Direction.UP
    elif event.key == pygame.K_DOWN and self.direction != Direction.UP:
    self.direction = Direction.DOWN

  • @godswillhycinth9809
    @godswillhycinth9809 2 года назад +8

    I'm a JavaScript Developer that knows nothing about python, but I must say I'm jelous 😭😭. This is really cool

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

      Python is way easier than JavaScript. Give it a try.

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

      Yeah, if you already know other languages(especially OOP) then Python shouldn't take more than a few hours to lean most if not all of its basics.

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

      I’m jealous of you. Python is super easy to learn.

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

    How can I get this terminal? :o

  • @PYUMUKU
    @PYUMUKU 2 месяца назад

    How I save my deep learning progress? Just to me dont need to do it again from 0?

  • @getoverhere4465
    @getoverhere4465 2 месяца назад

    1:01:53 What did he say?

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

    Does this tutorial teach how to write "inference" by myself, not using library?

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

    why not just give the ai full board information as the state

  • @DizzyPhantom
    @DizzyPhantom 3 месяца назад

    is there a way to learn how to do this faster by utilizing a gpu and multiple game windows at the same time?

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

    i just want to know after training, how can we load back a trained model?

  • @ashishbehal5903
    @ashishbehal5903 5 месяцев назад

    If someone can help me understand 1:31:34 it would be appreciated thank you

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

    Thanks for the video it was great but I have only one question if u can help after I run the agent and after a few try like 3rd game the game stuck and in the console suddenly start to count the number of game without the game really play

  • @__________________________6910
    @__________________________6910 2 года назад +2

    omg patrick wow

  • @carolinab9945
    @carolinab9945 10 месяцев назад

    Is it reinforcement learning even if you give some instructions about the movements?

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

    Is there a limit to when it stops learning? I mean the quality of the intelligence will stay the same at some point, or will it improve even more and more after those 12 minutes? Thanks.

    • @damienlmoore
      @damienlmoore Год назад +9

      At 34 mins, it breaks out of the game and starts gobbling up your filesystem. At 762, it breaks out of the machine and comes for you. 😅

  • @serverautism2268
    @serverautism2268 Год назад +3

    after 6000 games it averages at 33.4

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

    yes

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

    how to save the model...? where to know?

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

    So, my array for state is apparently returning NoneType. Anyone know a fix?

  • @hihi-kv1hu
    @hihi-kv1hu 6 месяцев назад

    How many Qvalues do you have?

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

    Found new hobby

  • @marcbringas1006
    @marcbringas1006 2 года назад +1

    where is he typing the commands? is this a CMD?

    • @science_horizonts
      @science_horizonts 2 года назад +1

      Do you mean the source code of the program or the command to run the program
      If to start, then yes, this is the command line(CMD), but you need to go through it to the folder where you have the project, CMD is somewhat similar to the explorer that goes through the folders

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

    I use your code and train it with speed 60000 (just modify the "game.py" file)

  • @piyushsrivastava7636
    @piyushsrivastava7636 2 года назад +1

    Can we create AI bot to play dice game?

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

      Well, it's already done. Almost every Ludo game has a bot. In fact you don't even need AI and ML for it as the conditions are so few that it can be hard-coded

  • @xrhstos1330
    @xrhstos1330 Год назад +9

    Very interesting topic, but a very bad teacher.
    He doesn't explain almost anything and the little he explains he talks about them very briefly like we already know all of those things and we make a revision.

    • @ttganglia
      @ttganglia 7 месяцев назад

      Exactly. Do you know some good tutoriors for this?

  • @atNguyen-zg8mk
    @atNguyen-zg8mk 3 дня назад

    why the state just is 0 or 1. why not another digit?

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

    true

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

    WHICH ALGORITHM IS USED IN THIS

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

    Crazy.

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

    very great course! thanks! A little question is , in class QTrainer maybe target = pred.clone().detach() ?

  • @RANDOM_DUD-qj3jd
    @RANDOM_DUD-qj3jd 10 месяцев назад

    no windows opened when I ran. not even any errors. how do i fix it?

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

    16:51

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

    can someone help me how to create a multiple snakes?

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

    somoone knows hot to imporve the snake so he does not collide with itself and loop over itself?

    • @aliabbas-xs6qm
      @aliabbas-xs6qm 11 месяцев назад

      Discard the AI an use a hamilton cycle kind liek how codebullet did in his video, It wont be an AI but it wont loop or kill itself

  • @AhmadBakdash07
    @AhmadBakdash07 2 года назад +2

    Not first 😑

  • @dereinedudeda5298
    @dereinedudeda5298 11 месяцев назад

    Grüße aus Deutschland