I Built A Snake Game By Reversing A Linked List (JavaScript & React project tutorial)

Поделиться
HTML-код
  • Опубликовано: 24 июл 2024
  • I combined algorithms and web development for the best software engineering project: a Snake game built in JavaScript and React that reverses a linked list. This video serves as a tutorial for the project, which happens to be a great beginner JavaScript project. The project's source code can be found here: github.com/clementmihailescu/...
    Create React App Instructions: reactjs.org/docs/create-a-new...
    0:00 | Preview
    0:19 | Introduction
    1:58 | Project Overview
    3:08 | Project Setup
    5:18 | Project TODOs
    6:58 | Tutorial
    39:53 | Reversing A Linked List!
    46:33 | Final Product
    47:53 | Conclusion
    AlgoExpert: www.algoexpert.io/clem
    SystemsExpert: www.systemsexpert.io/clem
    My LinkedIn: / clementmihailescu
    My Instagram: / clement_mihailescu
    My Twitter: / clemmihai
    Prepping for coding interviews or systems design interviews? Practice with hundreds of video explanations of popular interview questions and a full-fledged coding workspace on AlgoExpert - www.algoexpert.io - and use the promo code "clem" for a discount on the platform!
  • НаукаНаука

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

  • @clem
    @clem  3 года назад +197

    "You'll never have to reverse a linked list on the job."
    *Clement has entered the chat.*

    • @tanmaygautam1348
      @tanmaygautam1348 3 года назад +3

      that's why I don't like coding interview 😭

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

      I actually had to reverse a linked list on a couple of interviews. Tbh, not sure I could do it now out of the blue.

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

      Huge fan of you man! You are an inspiration to newcomers in tech. Keep up the work

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

      If only we could make snake on the job 😂

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

      Did you use a js framework for parts of the alogoexpert site or is it all plain js?

  • @YourAverageTechBro
    @YourAverageTechBro 3 года назад +105

    Hahaha wow, never thought the day would come where reversing a linked list would actually be used. Impressive stuff!

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

      Woah! I love your channel haha. Didn’t expect to see you here!

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

      But the day when it’s actually needed has not come yet

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

    love this format of building stuff every once and a while clem!

  • @zioping
    @zioping 3 года назад +31

    2:58 hearing it with eyes closed made chuckle

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

      😂

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

      @@clem Is there a “No Context Clément” Twitter account? Because this might need to happen.

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

    Woh! You have really made some serious use of reverse linked list.
    Good stuff.

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

    Really nice and refreshing video, awesome Clem !

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

    Pretty refreshing to see that an experienced programmer/entrepreneur like you can get stuck/frustrated on a "simple" bug... happens to me all the time at work!
    ~ "If you're really stuck on something, move onto something else and come back to it with a pair of fresh eyes"

  • @rbt-0007
    @rbt-0007 3 года назад +2

    Yesssss tutorial from Clément😃

  • @harispapadopoulos4295
    @harispapadopoulos4295 3 года назад +5

    That was worth the wait

  • @watcbd
    @watcbd 3 года назад +76

    "I don't THINK I'll need stack overflow." When imposter syndrome hits you right before coding a snake game.

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

    that's what I was waiting for 💥😘

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

    Finally something practice. Well thanks for the video,

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

    Someone needs to make a compilation of all the ways Clement has transitioned plugging algo expert. SOMEONE GET ON IT.

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

    This is great ! Pls do more "tutorial" series

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

    Wow!! I never knew someone had the same idea, I thought about it too when I started learning DSA but I couldn't implement it

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

    Thank you very very for showing that struggeling and getting annoying Bugs can even happen to such advanced people. Watching people get through their Code without any problems can give the feeling of being really far away from what a programmer should be able to handle

  • @hemanthkotagiri8865
    @hemanthkotagiri8865 3 года назад +51

    The ad that I got on this video: "So you know how to reverse a linked list, but do you know how to design a large scale distributed system?"
    Wow, perfect timing.

    • @clem
      @clem  3 года назад +41

      Next project: *I Built A Large-Scale Distributed Multiplayer Version Of The Snake Game*

    • @hemanthkotagiri8865
      @hemanthkotagiri8865 3 года назад +3

      @@clem Looking forward to it.

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

      @@clem plzz do. It'll be awesome to see

  • @giovannimarcon3822
    @giovannimarcon3822 3 года назад +5

    Wow, what a coincidence. I just finished coding my snake with js, but I am a simple guy so no linked lists shenanigans haha

  • @smaranh
    @smaranh 3 года назад +5

    Could you add this concept to AlgoExpert? Actual small projects based on the Algorithm problems in AlgoExpert?

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

    I like this type of video . Please keep it up

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

    More videos of this type plz :) 💙

  • @pulakdeyashi
    @pulakdeyashi 3 года назад +3

    Hi Clément,
    Please try to do a git commit on each baby steps. It will be really helpful.

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

    Thanks Clément Mihailescu

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

    Wow, you actually found a use case for reversing a linked list

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

    Thanks for this 🙂

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

    can you please suggest how to create multi dimensional array at run time with python.. i need dynamic array not static array

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

    Hi clement great video

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

    I'm waiting till this is asked on AlgoExpert. What do you guys think, easy, medium, or hard?

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

    The innuendo is astonishing 😂

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

    Clement the great
    Love from goa

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

    setInterval was never cleared, so there were multiple intervals running each with different closures

  • @adarshchhokar3818
    @adarshchhokar3818 3 года назад +24

    Has a big af monitor. Yet still codes on his 13 inch MacBook. BRUH!

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

    coding videos on clement's channel ? this is beyond science

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

    Keep doing coding videos for us clement
    I like that

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

    I like that you showed the bug when occurred, and how you dealt with it.
    Feels relatable.

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

    I had an idea of creating small projects as i go thru leetcode challenges, but that proved to be very challenging to me. would be nice if you could create a visualizer for leetcode challenegs - that would help me ( and probably other devs) tremendously

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

    Yes, please more coding videos!

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

    Nice Clement

  • @user-pi4vj3cm3u
    @user-pi4vj3cm3u 8 месяцев назад

    Somebody please explain what case he was talkin about on 30:20 "When you have only one node..."

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

    Why am I getting an algoexpert ad right before watching algoexpert 😂😂😂

  • @Abhishek-dp5tc
    @Abhishek-dp5tc 3 года назад

    38:23 Woah, I referenced to the same, Nice!!

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

    Game is still kinda broken. When you hit the wall, the snake stops alright, but when u press a direction key it starts moving again despite gameover. Please solve this. Thanks.

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

    I think we can use then finding loop Algorithm in Linkedlist to check if 🐍 tried to ate himself 😉

  • @inordirection_
    @inordirection_ 3 года назад +5

    First time I've heard "leave it as an exercise to the v i e w e r", haha. And now I know the main motivation for 'leaving it as an exercise': textbook authors just get tired and have other shit to do.

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

    move the end node to what the direction is relative to the start node

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

    So I guess we can expect a video on large scale distributed system.

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

    Clement i have a question is it possible for you to work from home as a software engineer?

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

    Clement please make more such videos. We really like to learn from you

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

    beo PLEASE do more videos like this

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

    HAHAHA ! You insane! Thanks for content!

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

    Nice monitor u got there
    Two 13" screens didn't make the cut

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

    Is that your WoW setup in the background? Are you gonna stream on twitch any time soon?

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

      No WoW these days, but other games 😉 -- and I'm not sure for Twitch. I'll definitely announce it if I do!

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

    didn't know you can use color palette on vs code.

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

    any Promo Code for algoexpert

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

    woww!

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

    24:20 "if you touch yourself you die !" where have i heard that before xD xD xD

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

    Impressive, but can you build a project that involves reversing a binary tree?

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

    Clement I'm currently learning JavaScript from udemy and have plans to become a front end engineer, but I'm concerned from articles and posts I've read that javascript will die in the near future, do you think that's the case?

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

      I don't think you should worry about that cuz even if it dies learning a language is easy as long as you know the concepts

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

      Hey unknown player. Just pick a language and learn it well. Once you learn a language, it will be easy to learn other languages. Concepts are pretty much the same; just a different syntax

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

    can you please make a video on "are web developers software engineers? How are UI or front end of desktop softwares made, if HTML and CSS are only used in web development?" and end the confusion.

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

    Love those typical surprise moments: 'Wait why is this working now' or 'This was working a moment ago'
    Also spending 20 minutes to find a broken conditional statement, I feel the pain. I once searched an hour for a '!' that was missing....
    Still surprising how good React works for making small games, would have chosen PixiJS or just a plain canvas probably.

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

    It will be cool ... if u make more videos ... of making .... coding videos .... plsssssssss ....

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

    31:22 "Oh... Wait! Why is this working...?!" 😄

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

    Sir just tell me what i should choose to make my final year project
    React
    Flutter
    I need help

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

      react is cool.

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

      if it's an app go for flutter; if it's a website go for react

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

      @@migueldomingos4570 Thats what im struggling with
      Web Development or App Development

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

      @@kimayapanash8998 I personally find app development more enjoyable and if you want to show something impressive for the final project app dev more easily impresses than web development.

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

      @@migueldomingos4570 i thought app development was easier to learn than web development

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

    Real talk: ultrawide monitor worth it?

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

    Now port it on nokia 3310 and bring early 2000s back :'-)))

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

    Wow! It's working, how did I do that. it's magical working.

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

    20:21 why is this not a switch statement or a class :O

  • @Abhishek-dp5tc
    @Abhishek-dp5tc 3 года назад

    24:38 Lmao, how big your snake is 🤣 🤣 🤣 🤣

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

    I remember playing this game on the Nokia 3310 back in the day! Looking forward to building this!

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

    Entertaining stuff! Now code an AI to play the game :)

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

    TechLead taught you well!

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

    Please take Google interview of @CodeWithHarry
    Great AlgoExpert from India

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

    Really curious about how long it really took - (imposter syndrome)

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

    Is that jiren on your desktop? Please tell me it's Jiren

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

    Why my code works magically, but it's awesome. lol😀

  • @Muna-yk5gi
    @Muna-yk5gi 3 года назад

    Clement, It'd be really cool if you could make a video about how you got into an ivy league college with some tips because you went to upenn.

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

    24:21 lol :D 24:37 LOL :D

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

    why not use canvas?

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

      and also why not use requestAnimationFrame instead of setInterval

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

    clem how much do you spend on advertising because almost on every video I will see algo girl

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

    ah I learn something new everyday. When I did a snakegame, I used an array for the snake, [{x:1,y:1},{x:1,y:2}] etc.. and then I just shifted the array 1 object, and inserted the new position for the head. and if the snake eat something, I did not shift the array, and made it one object longer.

  • @Abhishek-dp5tc
    @Abhishek-dp5tc 3 года назад +1

    16:10 haha, setIntervals are weird in React as it goes for its declarative programming approach
    Faced this too when I was creating a timer app
    Check out this post by Dan: overreacted.io/making-setinterval-declarative-with-react-hooks/
    It helped me

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

    MORE TUTORIALS PLEASE< PLEASE!!! please = [true, false] => please[0]

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

    Frustration with coding what makes a programmer good, How many hours you built it?

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

    funny but I have some comments :
    first, I think it is not good to use for keyword when we are front end dev, we only use map(), filter(), (..) only lambda function,
    second, I think to write the entire code on only one component is not a best practise, split more the code, because it is hard to see a typescript file with so many line of codes
    after say that is was a very advertising video

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

    Can RTX 3090 run this game?

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

    You took Ben Awad too seriously😂

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

    24:44 thats what she said

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

    hey clement you have to sleep, I am just worried because I know you haven't slept that night . )))

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

    Okay, You'll never invert a binary tree in a job. Clement says challenge accepted!

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

    Reversing a linked list in JS and Python is too easy. Real men do it in C++. Just kidding. Love your vids❤

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

    Get ready for 200 pull requests lol

  • @omfuke3083
    @omfuke3083 3 года назад +3

    i created chess game just by using if and else LOL

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

    Looks like a 13inch screen wasn't big enough for you after all lol

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

    "do you write code, tabnine will speed up your coding process"

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

    ex-google engineer creating a snake game!

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

    How many hours did it take you in real to build the complete game? :D

  • @TheFredybotas
    @TheFredybotas 3 года назад +3

    Nice project! I've been playing with snake recently too. I created a solver using hamiltonian cycles (see it in action here - ruclips.net/video/9AtxLypiqjA/видео.html)
    It would be nice to create a solver for this kind of reversable snake.

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

    Likewise being a successful software engineer at Google and Facebook and being good at making games are two different skills.

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

    I like your accent

  • @Lucas-hh4oh
    @Lucas-hh4oh 3 года назад +1

    22:30 This is what happens if you don't test your code