CODE WITH ME | Python Snake Game

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ •

  • @CSJackie
    @CSJackie  11 місяців тому +50

    The silly game code is available on GitHub: github.com/carmensantos/snake-game
    Code CSJackie15 for 15% off Code Chrysalis' immersive coding course in Japan 🤩
    p.s. please don't show this code to my boss

    • @ukaszbaczek7266
      @ukaszbaczek7266 11 місяців тому +1

      "Please, don't show this code to my boss." It would be worthwhile to rewrite this code in an object-oriented manner in the next episodes - it would be a great learning experience for the viewers and good material for a video or several videos.

    • @FredyantonioPelaezcastan-tv3nd
      @FredyantonioPelaezcastan-tv3nd 10 місяців тому

      You are novice , you video Is shit , the people saw the video , because you are women but your proyect Is Boring, Is Easy , a child the 5 Years able make the same proyect

    • @FredyantonioPelaezcastan-tv3nd
      @FredyantonioPelaezcastan-tv3nd 10 місяців тому

      You proyect Is shixt

    • @FredyantonioPelaezcastan-tv3nd
      @FredyantonioPelaezcastan-tv3nd 10 місяців тому

      You proyect Is boring

    • @com.youtube1
      @com.youtube1 10 місяців тому

      I've been trying to learn coding and I wanted to program a snake game, but unfortunately when I use pre-built shared libraries from internet, it becomes a frog game :)

  • @themichaelw
    @themichaelw 11 місяців тому +135

    1:34 You clearly haven't seen the spaghetti I'm able to produce in Java. Spaghetti code knows no boundaries; it transcends design patterns and exists in a higher dimension than we can never possibly understand.

    • @CSJackie
      @CSJackie  11 місяців тому +13

      i laughed out loud at your comment

  • @pawlkoech8541
    @pawlkoech8541 9 місяців тому +4

    i loved watching you solve the problems and being happy when something works.

  • @santiagoseijas9217
    @santiagoseijas9217 11 місяців тому +19

    It's really nice watching you doing some coding just for fun! I enjoyed the way you went through the problems since that is actual coding.

  • @TheTrienco
    @TheTrienco 10 місяців тому +3

    In a weird way, Snake is a good starting point to think about common data structures. How do you represent it? A double linked list is the easiest (add new position to head and pop last position at the tail, skip the second step when eating a fruit). But it's not an efficient structure (chasing pointers to find the next element can be slow). An array would be better, but then you'd have to grow (possibly reallocate and copy) and shift (copying everything by one position). A ring buffer would be perfect, but they usually aren't meant to grow. It could be a fun exercise to see how much you can "over engineer" the problem for best performance (which is of course very silly and pointless for a Snake game, but something AAA devs will have to worry about).

  • @akshat9090
    @akshat9090 8 місяців тому +3

    Dude you're the coolest tutor I've got! The way you're explaining makes so much more easier at least for my understanding.♥

    • @CSJackie
      @CSJackie  8 місяців тому

      Awesome, thank you so much!

  • @perlhacker
    @perlhacker 11 місяців тому +13

    always nice to do snake in some language. Awesome that you made us watch you doing it. And im Happy that it's same "struggle" on you side as it was on mine, it's always good to do a little thing outside the box of the normal "work" related programming work. Nice video.

    • @CSJackie
      @CSJackie  11 місяців тому +2

      haha for sure! thank you so much :)

  • @JohnBarratt2750
    @JohnBarratt2750 11 місяців тому +1

    I was born in 1963, so I was taught nothing whatsoever about computing at school . And only very superficially in Fortran at Uni.
    I am lost, watching this video, Jackie! But impressed.

  • @Andy-il7kf
    @Andy-il7kf 11 місяців тому +5

    This is great Thank you :) it really helps to see a professional going through the same process of finding mistakes, debugging etc and sticking at it until they get the project where they want it. It inspires me to keep going/learning when I get stuck on my owm stuff

    • @CSJackie
      @CSJackie  11 місяців тому +1

      thank you so much :)

    • @Andy-il7kf
      @Andy-il7kf 11 місяців тому +1

      @CSJackie PS It would also be great to see how you approached this OO in python too, as a comparison

  • @CodeChrysalis
    @CodeChrysalis 11 місяців тому +6

    Awesome Video!
    Really clever how you coded this Snake Game with another kind of snake! ;)
    Thank you so much for featuring us in the video, we look forward to working with you 🤝
    Keep up the good work 💪

  • @bobina_artz
    @bobina_artz 11 місяців тому +4

    Welcome back, MISSED YOU SOOOO MUCH😘

    • @CSJackie
      @CSJackie  11 місяців тому

      🥹 I missed you guys

  • @trex6142
    @trex6142 9 місяців тому

    Well done. I find it humbling to realize that I put in all of the errors in my code.

  • @raquelsilver21
    @raquelsilver21 9 місяців тому

    This is what I was looking for months! Just a ''code with me'' with simple exercises like a snake game! Please do more since since this helps so much people who wanna start coding but are stuck on the ''tutorial lane'''. What we are missing are projects and 'code with me' is perfect! Are you thinking about making a series of this? (Already Subscribed)

    • @CSJackie
      @CSJackie  9 місяців тому

      Thank you! Yes? the next one will be tic tac toe 🥹

    • @CSJackie
      @CSJackie  9 місяців тому

      Yes*

  • @Laura-nt3nd
    @Laura-nt3nd 11 місяців тому +6

    this video is so wholesome 😂

    • @CSJackie
      @CSJackie  11 місяців тому +1

      thank you

  • @seanwcom
    @seanwcom 10 місяців тому

    Fun evening project, thanks for sharing! I was just looking at your generate_starting_position() function and I think the reason your snake and target were originally appearing offscreen is because you aren't taking Y into account. You're creating a position_range based on screen width (1280), then returning both a random X and Y coordinate that are based on the screen_width pixels. This is causing you get sometimes land outside the height which is only 720 pixels. A quick change to turn position_range into position_range_x and then create position_range_y based on screen_height. Then be sure to use both position_range_x and position_range_y in the return. Not sure if UA-cam will format this weird or not, trying anyway:
    def generate_starting_position():
    position_range_x = (pixel_width // 2, screen_width - pixel_width // 2, pixel_width)
    position_range_y = (pixel_width // 2, screen_height - pixel_width // 2, pixel_width)
    return [random.randrange(*position_range_x), random.randrange(*position_range_y)]

  • @FitNiket
    @FitNiket 10 місяців тому

    you're coding skills are really good really looking forward for more of youre videos

  • @adam-xt8te
    @adam-xt8te 11 місяців тому +6

    I don't have idea what you're talking about but I'll watch and listen

  • @ricardoschenk5113
    @ricardoschenk5113 7 місяців тому

    Hey Jackie, Going to watch all your content! just finished my course of basic python and hope to get as good as you.
    greetz
    Ricardo

  • @DJRanoia
    @DJRanoia 11 місяців тому +1

    Glad you made it through Amazon video layoffs. Go Jackie! Another relaxing video, thanks!

    • @CSJackie
      @CSJackie  11 місяців тому +2

      I don’t know yet (European laws delay the process) so please pray for me 😃

  • @pulledporksammiches
    @pulledporksammiches 9 місяців тому

    Loved learning this and coding along. I also love your random trail of thoughts ♥

  • @KaiagaAg
    @KaiagaAg 6 місяців тому

    Hello my best instructor. Congratulations on this incredible tutorial!

  • @Antal46
    @Antal46 11 місяців тому +1

    I joined uni in London at 34, now doing my 2nd year of Computer Science. I just wish they were focusing more on practicing the actual useful skills and not just writing report, reference, academic style bla bla.
    You making some cool videos, giving me some ideas to be more efficient!

  • @robertorguez8148
    @robertorguez8148 10 місяців тому

    Coding is the best plan for a saturday evening! Period.

  • @kpm25
    @kpm25 11 місяців тому

    Thanks so much, I used this to get refreshed back into python, appreciated!

  • @artemKraft
    @artemKraft 10 місяців тому

    thank you for sharing your knowlage. It is amazing to see how the time is chaning. So thank you for sharing your knowlage with all other people.

  • @King56847
    @King56847 8 місяців тому +2

    why you look so beautiful when wearing glasses?🥹
    Edited :- Your coding thinking is so good btw great video ❤️

  • @sajadghamari4748
    @sajadghamari4748 8 місяців тому

    loved this problem solving challenge

  • @mustafa02-c6x
    @mustafa02-c6x 11 місяців тому

    Seeing the result of your work in front of you is amazing
    Nice work

  • @thejannzer
    @thejannzer 11 місяців тому

    Please do more of this stuff... it helps me so much

  • @serloinz
    @serloinz 11 місяців тому +1

    from what i remember about programming the delay from your keyboard to the snake (where it feels like it's not responsive) it's probably from your tick rate ..clock.tick(10) ..as it's not polling the keyboard as often. 60 would feel more responsive but you would obviously have to find another way to slow down your snake. I could totally be wrong but that's what my instinct tells me it is :)

  • @lancemarchetti8673
    @lancemarchetti8673 11 місяців тому

    Great upload! I'm definitely sending this to Matthew Berman.. he's gonna love it. He literally tested about 20 different LLMs, instructing them to create a simple snake game in py... and AI is still trying to get it right... lol.

  • @KojiKazama
    @KojiKazama 2 місяці тому

    The thing that got me out of spaghetti code is Uncle Bob's - Clean Code lessons. Also I am a software engineer (well DevSecOps and automation) but I can't wait to spend the evenings coding games in Unity and watching programming videos like this. I'd love to see if someone checks out this code and adds sprites, I'm curious to see them in pygame.

  • @iycsapphire
    @iycsapphire 3 місяці тому

    thank you for the introduction to pygame

  • @oreonengine9444
    @oreonengine9444 11 місяців тому +1

    I can remember, did this a my first university project, ASCII snake in the terminal haha, lots of fun :D

    • @CSJackie
      @CSJackie  11 місяців тому

      it's so fun!! my comp sci colleagues said they also coded this at uni haha

    • @matteoZattera
      @matteoZattera 10 місяців тому

      Lol, I also coded snake in the terminal with C++ and I uploaded a video on my channel

  • @alexeykhrapko401
    @alexeykhrapko401 11 місяців тому

    I expected to see usage of Sliding window algorithm for the snake cause it fits here perfectly. But that is a bit more advanced approach for this video.

  • @super-8
    @super-8 11 місяців тому

    Very Nice. Good Work and this is the beginning.

  • @justplayinggames963
    @justplayinggames963 9 місяців тому +2

    I don't know why coding looks so HOT

  • @adebayoemmanuel911
    @adebayoemmanuel911 11 місяців тому +1

    People like you make me fall in love with Programming ❤
    Thank you so much ❤

  • @sergeys7603
    @sergeys7603 7 місяців тому

    Very Nice and Helpful Tutorial. Thank You

  • @rockinvegan1765
    @rockinvegan1765 11 місяців тому +4

    Haha, I tried to program this game 35 years ago in Turbo Pascal.

    • @CSJackie
      @CSJackie  11 місяців тому +1

      😭 👑

  • @bumbam123
    @bumbam123 11 місяців тому +36

    Oh that's funny. "I won't do object-oriented, I will do spahetti-code instead". There is a huge world of procedural programming, some years back it was the way to write code. Procedural code is still a big part of your operating system. Not being object-oriented is not inherently bad, it's a completely normal way of doing things done

    • @CSJackie
      @CSJackie  11 місяців тому +6

      yes I like your point of view!

    • @ShinigamiGrin
      @ShinigamiGrin 10 місяців тому +1

      @@CSJackieit’s a fact not just a pov, it’s how things work….

    • @Shr11mp
      @Shr11mp 10 місяців тому +2

      Yeah, I took that as a personal attack when she said that 😆 OO is 90% of the time doodoo. A blend of procedural and functional is the way to go with sooo many scenarios. I can’t remember the last time I wrote OO, probably did a little bit right out of college, but that’s about it.

  •  11 місяців тому +2

    Jackie, weird question but where did you get your vest/sweater? My wife has always cold hands and this looks like half the solution of a sweater and hardwarmer in one 😆. Your content is very relaxing, keep it up 👍

    • @CSJackie
      @CSJackie  11 місяців тому +2

      Thank you so much! This one is from Amazon but I have a similar one from lululemon which also has the thumb slots lol 😄 the lululemon define jacket is amazing you can have a look!

  • @Jibril_Abdulkadir
    @Jibril_Abdulkadir 11 місяців тому

    Great vid Jackie 🩵

    • @CSJackie
      @CSJackie  11 місяців тому +1

      Thank you 🥹

  • @Netryon
    @Netryon 10 місяців тому

    One thing you wished to do is HTML CSS animating, because you know how easy is to move absolute square inline-block with arrows changing the x,y value as modern react/angular renders website not having to reload it or save and preload reinstalled graphics driver. Can build it, but from my experience I know must have that Laravel/symfony/.net core framework and don't spend your time on easy tasks already build by everybody else, which every empty youtube channel is obviously not and I can't paly it on fb.

  • @Velvetskyy
    @Velvetskyy 11 місяців тому +2

    Oh greate usefull video we miss uh and pls try to upload video daily lot's of ❤😊

    • @CSJackie
      @CSJackie  11 місяців тому +1

      Thank you so much!

  • @shadows_122
    @shadows_122 11 місяців тому +4

    14:41 is the face i make when something really simple that is not working for me 😂😂😂
    Sudoku or Chess might be a good challenge by the way

    • @CSJackie
      @CSJackie  11 місяців тому +3

      haha we're the same. oh my, challenge accepted! :D

  • @QuantumMeme
    @QuantumMeme 8 місяців тому

    Hello, I'm new in pyhton developing... in the video 1:01 in that time you installed oygame module can you clearfy it! please!!!

  • @com.youtube1
    @com.youtube1 10 місяців тому

    I Loved You~r Desktop monitor 🤩
    I Not engineer but loveed your content

  • @contaassinante5984
    @contaassinante5984 11 місяців тому +1

    I didn't like seeing Procedural programming used, but I thought the result and the programmer were really beautiful.

  • @jorgeraymason
    @jorgeraymason 11 місяців тому

    Not a huge fan of Python but your problem solving skills are on P O I N T.

  • @Deepak-ji3cx
    @Deepak-ji3cx 5 місяців тому

    Keyboard giving really good ASMR

  • @MudasirChanna-m3d
    @MudasirChanna-m3d 10 місяців тому +1

    You are a pretty good teacher like a lecturer, I love you so much !!

  • @minskwatcher
    @minskwatcher 11 місяців тому +1

    As a dev with 10+ yr experience, I'd like to just say thank you.

    • @CSJackie
      @CSJackie  11 місяців тому +3

      thank you for watching! :)

    • @minskwatcher
      @minskwatcher 11 місяців тому +1

      @@CSJackie it is suddenly way more relaxing to watch someone else code, especially when they do it nicely :)

  • @astralnomad
    @astralnomad 9 місяців тому

    Snake game actually goes back much farther than the Nokia.. it came out in the late 70s for simple home computers..

  • @diya.codes93
    @diya.codes93 11 місяців тому +2

    Hey Jackie, you plan to do more videos like this one? For example showing some backend or full stack?

    • @CSJackie
      @CSJackie  11 місяців тому +4

      If that’s what you guys want, then absolutely 😊 I did a few in the past

  • @moonshadows11
    @moonshadows11 8 місяців тому

    You are a good programmer 💜

  • @oscarmacho2798
    @oscarmacho2798 9 місяців тому +1

    What font do you use in VS Code? It looks very neat and clear

  • @wartyrant8627
    @wartyrant8627 10 місяців тому

    11:22 ASMR segment 🚶🏼‍♀️🥤🫧

  • @question2779
    @question2779 9 місяців тому

    as i work a lot doing hard stuffs like automations, softwares and things like this, when i reach at home i can´t even think about programming, i need plays video games

  • @pflagler
    @pflagler 9 місяців тому

    The game is delayed in responding to your keyboard inputs because you lowered the framerate of your main loop to 10 FPS. If a keystroke happens between frames, the loop doesn't catch it. Instead, I would recommend setting the framerate back to 60 and limit the speed of your snake a different way, like only moving it once every 3 frames, for example. You can use a variable to modify the speed, which you would want to do if you plan to accommodate multiple difficulties.

    • @CSJackie
      @CSJackie  9 місяців тому +1

      Ah makes sense, thanks so much!!

  • @Stephen_2330
    @Stephen_2330 11 місяців тому

    Look who I found because of UA-cam 🎉, and as a student of CS, I’m doing my thesis about a Web app😊

  • @nunoalexandre6408
    @nunoalexandre6408 11 місяців тому

    Love it!!!!!!!!!! Sooooo Beautifulll...Code....

    • @CSJackie
      @CSJackie  11 місяців тому

      Thank you!!

  • @qayyax
    @qayyax 11 місяців тому

    I really love this video

  • @andy_palms
    @andy_palms 10 місяців тому

    python is so cool! good video, greetings 🙂

  • @The.love1
    @The.love1 8 місяців тому

    amazing video ...plz continue and can you advice me what should i learn next i have just finished learning all python sntax and now i feel can not create this py game by my self ..plz tell me and thank you

  • @x12_79
    @x12_79 11 місяців тому

    I feel like the input issue is caused by the low frame rate. You could try and increase the frame rate to 60 again but create a simple timer to tell the snake when it can move.

    • @CSJackie
      @CSJackie  11 місяців тому +2

      Yes I think that would be a great way of handling this!

  • @rafinayel-r2q
    @rafinayel-r2q 10 місяців тому

    very cool video 💯

  • @PointEndClick
    @PointEndClick 10 місяців тому

    This video is awesome.

    • @CSJackie
      @CSJackie  10 місяців тому

      Thank you 🥹

  • @tamantije2463
    @tamantije2463 9 місяців тому

    Do you have any python tutorial for beginners? I would love to see that.

  • @LuisLopez-ns6yg
    @LuisLopez-ns6yg 10 місяців тому

    Hi Jackie great video I'm starting coding, I have a question recently I bought a ultrawide monitor like yours and I would like to know the dimensions of your desk in order to have a good workspace. Thanks in advance!

  • @draoi99
    @draoi99 11 місяців тому +2

    Well, I played Tetris for the most part.

    • @CSJackie
      @CSJackie  11 місяців тому +1

      I'll try that one next!!

  • @danielessien5256
    @danielessien5256 10 місяців тому

    When is the iterm2 setup releasing??

  • @Den-zt4ry
    @Den-zt4ry 8 місяців тому

    nice video. good job

  • @eric-222
    @eric-222 11 місяців тому +1

    Maestro!

  • @eytanbenittah
    @eytanbenittah 7 місяців тому

    What keyboard and switches are you using?

  • @Zer0kbps
    @Zer0kbps 9 місяців тому

    My PowerShell scripts always look like spaghetti on reflection and I can seldom read them after a few weeks, it's the human way I'm sure. I wonder if you could take your code and put it through chatgpt and ask it to make it look pretty, would it still work after is the question...I must try it?

  • @Abdullah-zl9ub
    @Abdullah-zl9ub 11 місяців тому

    I like these coding videos! Also I like how your genuine I your posts.
    Quick 2 questions: what’s your thoughts on SwiftUi?
    Is m1 MacBook Air a good upgrade and can code on it? (Using pro 2015 currently)

  • @JacquellynStuyvesant
    @JacquellynStuyvesant 11 місяців тому +1

    This video is incredible! What theme do you use?

  • @keshudioo
    @keshudioo 10 місяців тому

    This was so cool. The joy at 12:55 :) How long did it take?

  • @Rahul-rawat-01
    @Rahul-rawat-01 10 місяців тому

    Which IDE do you use . Please reply,
    Love from India ❤❤

  • @kadirdagkoylu210
    @kadirdagkoylu210 11 місяців тому

    i realy like it and please can u do more project video

  • @sciutosat6959
    @sciutosat6959 10 місяців тому

    im in love with you after watching this video

  • @xinzeng-iq7zv
    @xinzeng-iq7zv 8 місяців тому

    can u upload that game to your website for download

  • @micwax
    @micwax 10 місяців тому

    Great video . Can you put your gear info into your profile? I like your keyboard better than the one who came with my iMac. For coding, it's not the best. Thanks!

  • @waqarkhanpisces
    @waqarkhanpisces 7 місяців тому

    how many month did you take to learn coding ?

  • @freepythoncode
    @freepythoncode 11 місяців тому

    Thank you so much 🙂❤

  • @horvathpeter8130
    @horvathpeter8130 11 місяців тому

    Do you have a C++ version?

  • @mrflexii2067
    @mrflexii2067 11 місяців тому

    Even the simple games can take hours to code :D

  • @onurolce
    @onurolce 11 місяців тому

    I guess you've also generated a random position to put your Camera View on the center of code :) Why you did not put on right top or bottom corner where there will be no any code ?

  • @HammadKhan-fk2dn
    @HammadKhan-fk2dn 7 місяців тому

    Which IDE did you use

  • @edward3105
    @edward3105 10 місяців тому

    for how much time do you own that chinesse chair,is it good,does it worth the money?

  • @devoiddude
    @devoiddude 11 місяців тому

    Is that fleet you're using ?

  • @ДаниилБей-ж8в
    @ДаниилБей-ж8в 10 місяців тому

    You are well done

  • @marcoio8742
    @marcoio8742 11 місяців тому +2

    A file with 600 lines of code? I have seen functions with 800 lines of code in files with >3k lines. Oh no comments nor docstrings. That was hardcore

    • @michaeltse321
      @michaeltse321 9 місяців тому

      no problem. chatgpt please refactor lol

  • @ABHISHEKSINGH-nv1se
    @ABHISHEKSINGH-nv1se 11 місяців тому

    I am doing that in java and swing 🙂.

  • @vilmarcabanero2500
    @vilmarcabanero2500 10 місяців тому

    That's cool! Btw, can you share what brand of keyboard you have? It's cute. Haha.

  • @UCcdTp7XpCkVLkaRCsDcifFg
    @UCcdTp7XpCkVLkaRCsDcifFg 11 місяців тому

    yes i know this game, ikd enought

  • @Goodprogramer
    @Goodprogramer 11 місяців тому

    Great video with a great coding and inspirational content.following you so long .can you code a saas website?

  • @muhammadumair9020
    @muhammadumair9020 8 місяців тому

    i am a mechanical engineer
    how can i learn python and get benefit from it?
    can you guide?

  • @cherymara
    @cherymara 8 місяців тому

    please tell me what kind of computer mouse is this