No video

Coding Challenge #3: The Snake Game

  Рет қаралды 3,390,246

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 3 500
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
If you want to know what happened during "technical difficulties"! kzfaq.info/get/bejne/r7t_ZcWIy6jLfmw.html
@dixoncyprian8633
@dixoncyprian8633 5 жыл бұрын
cool bro
@karuhunc
@karuhunc 4 жыл бұрын
So fast😮
@Nurutomo
@Nurutomo 4 жыл бұрын
Why not using "shift()" "unshift" "pop()" "push()"?
@nugs2727
@nugs2727 4 жыл бұрын
NsG Frantic just copy him but this is how Function setup() { CreateCanvas(400,400) } Function draw() { background(51) } This is in java script. If you wanna know in a different language than you can watch a tutorial video Edit: function draw is optional, it just changes the background colour or if you wanna draw a circle or a square
@pratigyasingh317
@pratigyasingh317 4 жыл бұрын
Wow wow wow
@Warm_Ice0
@Warm_Ice0 7 жыл бұрын
Anyone get this guy randomly recommended to them? Im loving it.
@tarkin843
@tarkin843 7 жыл бұрын
Daniel Esen J. Oliviėr Yes
@Kevin-ji1sr
@Kevin-ji1sr 7 жыл бұрын
Daniel Esen J. Oliviėr I think KZfaq can read my mind ;)
@diyansueka3192
@diyansueka3192 7 жыл бұрын
Yes
@user-ys1gt7ze9s
@user-ys1gt7ze9s 7 жыл бұрын
yep...i want to learn how to programme and how to code :/ and then this guy comes out :D
@Hanzi2u
@Hanzi2u 7 жыл бұрын
Daniel Esen J. Oliviėr yes i just watched the purple rain video by him
@thelavagod
@thelavagod 7 ай бұрын
Hey there Daniel, It's me in 2024. Back in 2017, I discovered this video and this was where my programming interests began. I first started off by learning JavaScript (because it was the language you were using) then Python, a bit of C++, Java and Ruby and I went into more advanced stuff such as Logic, and how programming languages work, and computer science. I learned how to code in Visual Basic, as well as learning about the parts of PC, the basic input devices, the BIOS, and more. All because I discovered this video of yours. I cannot find the words to express my gratitude to you.
@TheCodingTrain
@TheCodingTrain 7 ай бұрын
Thank you for sharing this, I'm so happy to hear!
@lakhaidir9284
@lakhaidir9284 4 ай бұрын
Woah, despite 7 years later you're still replying comments tho. Respect...
@captstrugglebunny
@captstrugglebunny 5 жыл бұрын
It is pretty amazing that a game that was once considered good enough for commercial distribution in arcades became a time waster pack-in on cellphones, and then finally a 30 minute coding tutorial.
@chonkydog6262
@chonkydog6262 2 жыл бұрын
I'd pay a quarter to play snake
@bleepboop
@bleepboop 11 ай бұрын
The framework does some pretty heavy lifting here compared to 1976-versions
@shanewalsch
@shanewalsch 7 ай бұрын
​@@bleepboopthe main loop and drawing. Its not that hard to implement yourself
@rdevan3245
@rdevan3245 4 ай бұрын
​@@shanewalschcool. Now try it with the technology that was actually available in 1976 lmao
@wifeless
@wifeless 5 жыл бұрын
Damn! This video is almost 3 years old and you're still responding to comments? Saw you in my recommended and found the video super interesting. Thanks!
@sujatha.a9702
@sujatha.a9702 4 жыл бұрын
😂
@bodharajdahal4855
@bodharajdahal4855 4 жыл бұрын
😁
@the_neto06
@the_neto06 4 жыл бұрын
this comment had 666 likes lmao
@xuxavier6924
@xuxavier6924 4 жыл бұрын
4 years now lol
@risab6218
@risab6218 4 жыл бұрын
Still responding....
@dennisvargas7719
@dennisvargas7719 7 жыл бұрын
do call of duty next
@radecreative6620
@radecreative6620 7 жыл бұрын
In 15 years 😂
@Jorolfs
@Jorolfs 7 жыл бұрын
KZfaqr shots fiyerd :P
@Robert_199
@Robert_199 7 жыл бұрын
too easy
@johnsims9907
@johnsims9907 7 жыл бұрын
Like from the ground up writing an effects engine and everything?
@slowdragon4169
@slowdragon4169 7 жыл бұрын
lmao
@AjeetSingh-xq4yb
@AjeetSingh-xq4yb 7 жыл бұрын
dont know why this channel appeared in my recommended, clicked on 1 video and have been browsing for hours now. This makes we want to learn to code.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
+Ajeet Singh I'm really wondering why it's being recommended too! Lots of new viewers thanks for the comment. (Take a look at my foundations of JavaScript playlist if you want to learn from the beginning)
@phinix827
@phinix827 7 жыл бұрын
haha got it recommended too :D i haven't watched many of such videos :D but VERY nice :D I mean i watched nearly the hole video even if im not into coding :D
@johnpyp
@johnpyp 7 жыл бұрын
Just appeared in my recommended as well, maybe because I have been learning to code, but I love these videos!
@alephbet6265
@alephbet6265 7 жыл бұрын
this appeared on my recommended because i learn python
@Dylan5246
@Dylan5246 7 жыл бұрын
X-Core Aleph but this is javascript
@The_Foreman
@The_Foreman 5 жыл бұрын
"Hello and welcome to what today will be a 15 minute coding challenge" *Looks at video length* Uh huh....
@forest3064
@forest3064 4 жыл бұрын
Well, work expands to fill the time given.
@abdelrahmanmohamed6701
@abdelrahmanmohamed6701 4 жыл бұрын
He takes more time to explain for us We appreciate your efforts 🙏😊😘
@Melvin420x12
@Melvin420x12 4 жыл бұрын
Basically every project ever
@k-vin2073
@k-vin2073 4 жыл бұрын
@@abdelrahmanmohamed6701 indeed
@hackwise
@hackwise 7 жыл бұрын
You totally earn my respect , you are a great programmer and mentor, thanks for all your videos.
@um_idkw
@um_idkw Жыл бұрын
252 likes and no replies, I honestly don't care.
@camelcase9225
@camelcase9225 7 жыл бұрын
Seriously wish I could code like you. I can think of what I need to do but can't implement it as effectively as you can. I just found this channel randomly and am loving it! You're very entertaining.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
so nice to hear, thank you!
@Savage_Gamer777
@Savage_Gamer777 6 жыл бұрын
Radbeh Yousefi you don’t need college.
@derronwhite375
@derronwhite375 6 жыл бұрын
I wish i can code like him too
@meanstreak110
@meanstreak110 6 жыл бұрын
The Coding Train Ha! You're a narcissistic person. At least in this comment you are...because I thought you were gonna help him out....but no. You don't care :( Edit: I've seen enough of ur content to know that you just care about yourself. #NARCISSISTIC-af
@Guevara1015
@Guevara1015 6 жыл бұрын
nah, he's a lovely guy. He posts videos on basically everything related to coding (mostly Processing stuff). I've probably seen more of his content than you do so I know he's just a great guy sharing his love for programming. He isn't google. If you need answers to a specific problem, let me inaugurate you into the upper class of programming: StackOverflow. your welcome
@NiiAnikin
@NiiAnikin 4 жыл бұрын
just jumped on the javascript/coding train and I'd love to say, this is the most useful video, I have seen to date. I know enough to understand the basic mechanics of whats going on here but seeing this implementation and real time description is super awesome and very useful. Big thumbs up
@Horse-tradeEu
@Horse-tradeEu 2 жыл бұрын
Story of every programmer, will finish by tomorrow. Three years later... Thank you man, I am learning so much!
@ALLCAPS
@ALLCAPS 7 жыл бұрын
I love how you fucking start from a CHALLENGE but then you shift into this in-depth tutorial and omg I LOVE HOW YOU TEACH
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Heh, thanks for the feedback. :)
@ALLCAPS
@ALLCAPS 7 жыл бұрын
I wish I was as fluent as you are in the Java script, and Java language. I'm currently in school for programming, and will aim to be a senior-software engineer one day.
@JordanShackelford
@JordanShackelford 7 жыл бұрын
at 12:23 instead of writing out "if (d
@DareDevilPhil
@DareDevilPhil 7 жыл бұрын
Jordan Shackelford true, however that function is later modified to increment this.total
@JordanShackelford
@JordanShackelford 7 жыл бұрын
He explained in another vid that he does this on purpose to make code more readable. just letting you guys know there's another way
@sloppyy
@sloppyy 7 жыл бұрын
scrolled down to see if anyone had said this already
@Yopi69
@Yopi69 7 жыл бұрын
Ivan Dobrev a
@MineMoore
@MineMoore 7 жыл бұрын
Chris Pierce hi Chris pierce big fan
@FelixxFelixx-tt7sf
@FelixxFelixx-tt7sf 4 жыл бұрын
I dont know how, but in only 15 minutes, you taught me more than multiple hours of someone speaking my language
@marlynstark341
@marlynstark341 6 жыл бұрын
Never knew JavaScript codes are so light and u can do much with so little.....
@SleazyNice
@SleazyNice 6 жыл бұрын
He is using a library that hides much of the code.
@Jackarius86
@Jackarius86 6 жыл бұрын
Raymond Cruz it isnt THAT much code that is hidden. You could do the same using canvas with exactly the same number of lines possibly less, which are also just as easy to use.
@azizalaliq8
@azizalaliq8 5 жыл бұрын
Ikr I've been using pygame and its so intensive
@smanzoli
@smanzoli 5 жыл бұрын
@@azizalaliq8 Don´t use pygame, use processing.py (just the same language as the P5 used here, but with Python instead of JS)
@tilostammwitz4226
@tilostammwitz4226 5 жыл бұрын
they aren't - this dude shows only a part of the code. As in his other "challenges" he types some code, and some kind of strange framework does things like drawing, etc. I never saw him starting a project from scratch - every time an empty window - he writes some functions, that are never called in his code and, tadaa.... some kind of fancy animation. Professionals can't learn anything from him - they can do at their own - and beginners don't understand anything. Kind of useless in my opinion.
@invictuz4803
@invictuz4803 7 жыл бұрын
Wow, just randomly found this video. Now I understand javascript...i think
@senpaisanchoyt5225
@senpaisanchoyt5225 7 жыл бұрын
Hey im taking classes for this and i understand this.... i think. I won't say its hard but there is alot of difficulties.
@invictuz4803
@invictuz4803 7 жыл бұрын
SenpaiSancho YT What kind of difficulties? And are you taking these class online for free?
@Yorelz
@Yorelz 7 жыл бұрын
InvictuZ try out something like CodeHs it's where I started (prior experience with Python)
@senpaisanchoyt5225
@senpaisanchoyt5225 7 жыл бұрын
InvictuZ School, we are just messing around with and programming a robot.
@ginney1032
@ginney1032 7 жыл бұрын
InvictuZ hahaha, no you don't ;)
@quantumvac7737
@quantumvac7737 7 жыл бұрын
Him Talking : 15 minute challenge On-screen Bar : 10 Minute Challenge Video Length : 30 Minutes Me : Seems Legit.
@jonathanmorrison8223
@jonathanmorrison8223 5 жыл бұрын
15:25 lol
@kingfoxx6697
@kingfoxx6697 5 жыл бұрын
😂😂
@skilz8098
@skilz8098 4 жыл бұрын
I agree I can probably write the code in about 15 - 20 minutes to solve a problem, but it will probably take 2-3 times that to fix compiler errors and to debug it! Then again I don't use Java, I'm accustomed to C and C++, rarely C#... I did start to learn Python and that I don't mind, Python is pretty decent, Java eh... Now, JavaScript isn't too bad, but it takes a bit to get accustomed to it but I don't do much "web development". I word on the backend, libraries, interfaces, 3D graphics or rendering engines, etc... I do a bit of hardware emulation, etc. This is why I prefer C/C++!
@mattwayne9128
@mattwayne9128 2 жыл бұрын
@@skilz8098... Wrong thread? I don't believe what you just said is relevant to anything in this comment section.
@brandonnorsworthy
@brandonnorsworthy 5 жыл бұрын
"I'm going to make var s, mainly to save time.." proceeds to keep talking about var s for more time than it would've been to create var snake
@AndresHernandez-dc6ow
@AndresHernandez-dc6ow 3 жыл бұрын
I have a question what does var S do?
@kaskadouff1349
@kaskadouff1349 3 жыл бұрын
@@AndresHernandez-dc6ow i think var s is the variable where a instance of the Snake 'class' is stocked (but im not sure, and even not if it's called a class in javascript too)
@IndianGamer-qz8lf
@IndianGamer-qz8lf 2 жыл бұрын
I like how coding challenges are suspenseful, entertaining and informative at the same time 🌀
@k2k4
@k2k4 7 жыл бұрын
so i spend 4+ hours trying to understand and copy verbatim what another person did to make snake in a youtube video, and you get it done in like 25ish minutes. Absolutely brilliant coding skills dude.
@dm8dd
@dm8dd 8 жыл бұрын
genius, haven't coded for 15 years, tempted to have a go again. thanks bro!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@StelznerGaming
@StelznerGaming 4 жыл бұрын
As someone who just got into coding I am so happy I just found your channel. Love your passion!
@LapSiLap
@LapSiLap 6 жыл бұрын
You dont need a head and a tail. You can have 1 array with 1 vector in the beginning and when it grows you just push a vector to it. To update it, you will set for example index 5's position 4, 4->3, 3->2, 2->1, 1->0 and then index 0 being the head will just head whatever direction the player controls it. Update function will be much easier: // Move the tail for (var i = this.snake.length - 1; i > 0; i--) { this.snake[i].x = this.snake[i-1].x; this.snake[i].y = this.snake[i-1].y; } // Move the head this.snake[0].x = this.snake[0].x + this.xspeed * scl; this.snake[0].y = this.snake[0].y + this.yspeed * scl;
@amirhamzah6146
@amirhamzah6146 4 жыл бұрын
you are brilliant
@52.yusrilihsanadinatanegar79
@52.yusrilihsanadinatanegar79 4 жыл бұрын
genius
@bendertequila8881
@bendertequila8881 4 жыл бұрын
awesome! this solution is the one i was trying to do :)
@lastsecond959
@lastsecond959 4 жыл бұрын
I don't know what it says because I only know a bit (very little) of C and java, but I still give it a like.
@ahmadyogi1340
@ahmadyogi1340 4 жыл бұрын
Thank you
@juleslardon3036
@juleslardon3036 7 жыл бұрын
how gome i enjoy watching you code but i dont accually know how to code :P
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
+TheBaconGamer that is amazing to me. Go back and watch my intro to JavaScript playlist and learn!
@juleslardon3036
@juleslardon3036 7 жыл бұрын
+Daniel Shiffman i will :D
@11ditto11
@11ditto11 7 жыл бұрын
TheBaconGamer hahaha I was thinking exactly the same
@epilefchannel9424
@epilefchannel9424 7 жыл бұрын
wow... happens the same to me lol.... i'ts fun as fuck... but no clue how to even code xD, don't even know how i got to this channel, gonna sub xD
@sigurdriseth5923
@sigurdriseth5923 7 жыл бұрын
TheBaconGamer true
@taylorhetherington745
@taylorhetherington745 7 жыл бұрын
Damn I wanna be like you, that's my New Years resolution :p - be energetic - be good at coding - wear cool shirt combos - be generally brilliant
@Felixpf1
@Felixpf1 7 жыл бұрын
Hjard Kuk so stop playing lol you lazy piece of shit :D
@taylorhetherington745
@taylorhetherington745 7 жыл бұрын
Felixpf1 I haven't played in a while, logged on today and fed my ass off :p
@armanpapa3
@armanpapa3 7 жыл бұрын
add being a cringey weeb to ur list
@taylorhetherington745
@taylorhetherington745 7 жыл бұрын
ReX - donald trump pp - uploaded a picture of a girl to ur g+ page - name is rex You're the cringey one and I've never watched an anime, apart from pokemon when i was kid
@tryhitmecs9699
@tryhitmecs9699 7 жыл бұрын
lol rekt trump got stumped
@whoami1223
@whoami1223 3 жыл бұрын
he couldve done this in 5 minutes if he wasnt worried about the time or explaining what everything is.
@OfficialZaire
@OfficialZaire 3 жыл бұрын
In Italy they'd called him "fulminato"
@iamoneofHERO
@iamoneofHERO 3 жыл бұрын
And the moronic acting too
@siddharthswami9148
@siddharthswami9148 3 жыл бұрын
Exactly
@matiastoledo4201
@matiastoledo4201 3 жыл бұрын
He should had either focus on doing the challenge or just making a good video explaining the code as he was writing it, but still the video was simple and understandable
@georgiymalinovskiy3118
@georgiymalinovskiy3118 3 жыл бұрын
His amusing behaviour is what makes it worth WATCHING, if I need to get a quick ref - I'l check github sources or whatever.
@joem8251
@joem8251 5 жыл бұрын
Your tutorials are helpful. I recommend losing the time limit for most videos. A calm problem solver is more effective, applicable, and instructional. An arbitrary time limit can be meaningless without statistical metrics and a rigorous measure of problem complexity; but even then, a strong focus on time limits seems to be detrimental. Either way I appreciate your effort!
@TheFloatingSheep
@TheFloatingSheep 7 жыл бұрын
2:27 I'm nervous about wasting time so I'm just gonna call it "s" then brag about it for a minute. - Daniel Shiffman 2016
@mateopolanco213
@mateopolanco213 7 жыл бұрын
4 years of learning programming this challenge will probably take me a week. I'm bad
@flowolf86
@flowolf86 7 жыл бұрын
mateo polanco he prepared for it obviously...
@muhanad102
@muhanad102 7 жыл бұрын
yeah but if you did it once ...the next time you will do it in 1 day...then 50 min ...and so on coding is a language when you speak it alot you become fluent
@skylarkenneth3784
@skylarkenneth3784 6 жыл бұрын
It's a matter of doing two things at the same time: 1) Visualizing what you want a program to do 2) Visualizing how your code works line by line In other words, debugging as you code. The big takeaway from this is having a good spatial memory or abstract thinking.
@phunguyenuc3747
@phunguyenuc3747 5 жыл бұрын
Oh boi, I love youtube recommendation. They brought me to this wonderful art of coding
@pie7747
@pie7747 4 жыл бұрын
the best to master something is learn from mistakes, when other videos shows they' have non mistakes during program it, it's hard to understand each of the component . this is an excellent example to learn and understand parts by parts. thanks sir
@pulisichhh
@pulisichhh 7 жыл бұрын
Dude, you code like in movies. Keep going.
@ScibbieGames
@ScibbieGames 7 жыл бұрын
Speedcell nobody codes like in movies
@andrewking9271
@andrewking9271 7 жыл бұрын
Course you can. All you have to do is penetrate the firewalls and reverse the mainframe.
@Yorelz
@Yorelz 7 жыл бұрын
Andrew King I don't even think a mainframe is an actual thing 😂 gotta love movies "code.hackperson"
@fox091
@fox091 7 жыл бұрын
Joe Biden Mainframe is an actual thing. We have one and use one at work. It's just not what you think of it as.
@EnterpriseKnight
@EnterpriseKnight 7 жыл бұрын
Don't forget to Enhance.
@ChuckNorrisRullZz
@ChuckNorrisRullZz 7 жыл бұрын
You are seriously the most entertaining person while teaching code! Wish my professors were like you. lol Been binge watching all your Code Challenges
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Thanks for the nice feedback!
@bersi3306
@bersi3306 9 күн бұрын
I like how he spares no words for the explaination against the time...he just speaks faster
@pikachuu3542
@pikachuu3542 4 жыл бұрын
I dont know anything about programming but i enjoyed watching this video
@aaronsundstrom9921
@aaronsundstrom9921 4 жыл бұрын
Huwaran GT same
@EdwardGordington
@EdwardGordington 7 жыл бұрын
i want whatever this guys having lmfao.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
+Mazzza3 chamomile tea.
@hatben
@hatben 7 жыл бұрын
Posted on 4/20 :P
@mkmush1982
@mkmush1982 7 жыл бұрын
Daniel Shiffman more like Daniel Sniffman.. But great video!
@roychh1
@roychh1 7 жыл бұрын
meth
@iwanttodie8331
@iwanttodie8331 7 жыл бұрын
I dun bet it's Adderal
@Jan-vw5cg
@Jan-vw5cg 7 жыл бұрын
I've always thought that I look/sound like I'm mental every time I explain my codes in class. Now that I found your videos I'm certain that everyone thinks I'm insane... This is like looking at a mirror.
@Aspectalice
@Aspectalice 6 жыл бұрын
Jan what class are you doing?
@fuelks
@fuelks 6 жыл бұрын
"codes" lol
@denzel3972
@denzel3972 6 жыл бұрын
Amir Noble computer science maybe
@dvnmnd5020
@dvnmnd5020 6 жыл бұрын
Arach Thou shall not pass
@Ray-jg5dj
@Ray-jg5dj 5 жыл бұрын
"Ce qui se conçoit bien s'énonce clairement et les mots pour le dire vous viennent aisément." Rough translation : "What is nicely designed is easily explained". If you have trouble explaining what one of your classes do, rethink the class.
@maluxon5324
@maluxon5324 5 жыл бұрын
I just started to get into programming recently and i definetly won't be able to build such a code yet but im so happy that i understood 80-90% of the steps you did there. That is a great motivation ^^
@maaziik1166
@maaziik1166 4 жыл бұрын
Such a great video, even though I didn't understand a single word. This got me so hyped, guess I am going to start coding
@hmm-.-
@hmm-.- 8 жыл бұрын
And you just got a new subscriber :D You are amazing!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
thank you, so glad to hear!
@zakisudo9611
@zakisudo9611 8 жыл бұрын
+1:)
@Meganthamac
@Meganthamac 8 жыл бұрын
Agreed! Subbed!
@extremist0276
@extremist0276 8 жыл бұрын
Same!
@chrit8519
@chrit8519 7 жыл бұрын
Love his enthusiasm when he making these video. You can tell he has so much passion for what he does.
@masonengland306
@masonengland306 2 жыл бұрын
“Debugging” means awkwardly staring at the code and doing nothing wondering where you went wrong…then spacing out
@mohamedekwa3777
@mohamedekwa3777 3 жыл бұрын
I loved adding the Arabic language for translation, please continue with that, Your follower from Egypt, thank you ❤✌
@Lamarsh67
@Lamarsh67 7 жыл бұрын
I've been feeling bummed about my coding ability lately because I'm entering the final year of my university degree and university has been such an awful experience for me. I decided to attend a technical institute next year and complete a two year program for a computer systems technology diploma. Initially seeing this video made me sad because I know I'd never be at your level but when you didn't complete it in the time limit and had so many other things to solve after the fact, it just resonated with me so much and I felt the exact same feelings when I'm working on a difficult assignment. You have that initial clarity and almost simplistic idea of the assignment but then you start coding and the devil really is in the details which only becomes apparent the more you code. Thank you for being so inspiring and I really want to commend you on your skill as a programmer!! Cheers.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
love this comment!
@Robertlavigne1
@Robertlavigne1 8 жыл бұрын
Wow!! just found your channel and I have to say you are a boss. No way I could do that in the time you banged it out and I do a lot of topcoder competitions. You earned my sub. I think an efficient data structure for the snake would be a circular linked list. As only the last block and first block are moving. I guess this assumes that the snake is moving one grid per time unit though which I don't remember if yours was doing. But I suppose we can leave optimizations for the C monkeys.
@BulldogMindsetArchive
@BulldogMindsetArchive 8 жыл бұрын
Definitely incredible. It definitely caught my attention ha
@SammYLightfooD
@SammYLightfooD 6 жыл бұрын
I didnt code in python for 2 years and now I built a working Snake game in an evening. Thanks for this!!
@OakSwami
@OakSwami 6 жыл бұрын
Damn dude... You make programming so intertaining! Im gonna start watching your vids to learn and try to pass my subject. xD
@MrCKay26
@MrCKay26 7 жыл бұрын
There's a neat way of implementing a snake: You might notice that none of the snake elements, except the first and the last change. So you could simply create a dequeue, and every time the snake moves, an element gets added to the head (as the snakes current head + it's speed) and an element removed from it's tail. When the snake eats the food, you simply don't remove the element from it's tail. An efficient dequeue would ensure that snake.update is an O(1) operation, as opposed to shifting which is an O(n) operation, where n is the size of the snake. Simpler and Faster code! Also all food collisions and edge collisions would need to only check the head against them, which I think you're doing already, so that's not much of an improvement. I would suggest creating a new Snake object when a collision happens however, so that it's obvious that the snake starts over.
@kenneybohjort4314
@kenneybohjort4314 8 жыл бұрын
The adderall is strong in this one :D
@Baelfyr
@Baelfyr 2 жыл бұрын
I know this video is 6 years old, and i love your videos regardless, but things like this, i would love to see long form videos of, like, coding the entire game, add graphics, code the death of the walls, and the going backwards, code it all, i could watch this all day long.
@bytezorro
@bytezorro Жыл бұрын
Hi! I've recently started a channel about coding, where I show all the steps in ASMR format on how to create programs. Would love it if you could give some feedback on the content. Thanks Happy coding!
@The_Foreman
@The_Foreman 5 жыл бұрын
The pickLocation can be simplified down to: x = floor(random(width/scl))*scl; repeat for y width/scl sets the columns, random picks one, floor aligns it(drops the decimal), *scl resizes back to full scale.
@BulldogMindsetArchive
@BulldogMindsetArchive 8 жыл бұрын
This was amazing lol Will definitely consider doing some of those for my channel Ha! Amazing video
@ayazahmad6378
@ayazahmad6378 8 жыл бұрын
respect..nice to see
@radioleta
@radioleta 7 жыл бұрын
Hey, John. I din't expect to find you here!
@toxanism6050
@toxanism6050 6 жыл бұрын
were you using atom
@gnamp
@gnamp 8 жыл бұрын
If only we could pull that "technical difficulties" trick during our final exams...
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Hah!
@all-roundtech4872
@all-roundtech4872 5 жыл бұрын
How many of you are understanding nothing but still watching 😂😂😂
@sabirnawaz1304
@sabirnawaz1304 5 жыл бұрын
Manisha Mhetre
@supercool1312
@supercool1312 5 жыл бұрын
Manisha Mhetre me
@abbywiley6467
@abbywiley6467 5 жыл бұрын
Not me, I've been studying processingJS for months now. I understand everything he's saying. Have an outstanding day!!!
@chappie3642
@chappie3642 5 жыл бұрын
@@abbywiley6467 who cares lol, and processing isn't that hard of a thing
@abbywiley6467
@abbywiley6467 5 жыл бұрын
@@chappie3642 Good point, I agree. processing isn't that hard, I'm just prideful that I'm 12 and understand it while some people at my school don't care enough about anything to even try to do mental math and when given the opportunity, will only use the calculator.
@inkhole
@inkhole 5 жыл бұрын
Just learning at the age of 54 and after watching a pro - "my head hurts". Very inspirational!
@locrates
@locrates 7 жыл бұрын
i know nothing of code. reeeealy wanted to see it complete =/
@radecreative6620
@radecreative6620 7 жыл бұрын
Same
@T0ly113
@T0ly113 7 жыл бұрын
locrates just learn to code?
@locrates
@locrates 7 жыл бұрын
You know- Id love to learn but I'm such a slow learner. I have a couple of graphic designs for apps, one I know damn well facebook would be down to buy.. I'm simply hoping my youtube channel next year helps me be put in the position I could work with someone who really knows what they are doing to make the app possible..
@vernonalbayeros4719
@vernonalbayeros4719 7 жыл бұрын
if you want to learn at your own pace, hit codeacademy up, it's got free courses on c,c++, python and javascript. Udemy sometimes offers discounts on their courses for around 15€ if you want more advanced stuff :)
@izybit
@izybit 7 жыл бұрын
You can check freecodecamp.com for completely free coding lessons.
@Yorelz
@Yorelz 7 жыл бұрын
Wow a guy that can actually keep me interested and still tell me what the stuff does
@smilingalpaca1025
@smilingalpaca1025 5 жыл бұрын
I can't believe the fact that I've watched this vid a few months ago without any knowledge for programming and now I'm here again realising that he's actually using Processing, that I'm actually learning with
@2b4u-lmpedro14
@2b4u-lmpedro14 5 жыл бұрын
I'm trying to learn to code. The basics r so boring but I learn so much for these video your fast pace and explaining as you go really keeps me watching
@job2k656
@job2k656 8 жыл бұрын
I'm currently in college and just finished the second semester of my program where we covered basic JavaScript. I'd love to have you as a teacher for JS. The classes would be hilarious and highly educational. I'll have to settle for the videos, which are also great! Cheers.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
+job2k6 Thanks for the nice feedback!
@burzumumbra
@burzumumbra 8 жыл бұрын
+job2k6 I support dat thought, at my colleger they didn't teach JS or nothin related to web.
@tim..indeed
@tim..indeed 8 жыл бұрын
+Ronald Flores That's weird. What did you study?
@burzumumbra
@burzumumbra 8 жыл бұрын
+Tim Fischer Computer Ing.
@TheRealDexeN_
@TheRealDexeN_ 7 жыл бұрын
24:48 - look at his face :D:D:D - runs the snake backwards. - dies from it - doesn't know whats going on - realizes that the "death" really worked, because he just died by running backwards.. - realizes that it's actually impossible to run backwards in the original game AT ALL - ...? :D its actually entertaining watching you code :D
@jfaquinojr
@jfaquinojr 4 жыл бұрын
i like this because its so realistic. underestimating tasks for each pomodoro and making (valid) excuses about 80/20 rule etc.
@pnkfld7892
@pnkfld7892 4 жыл бұрын
Thanks for inspiring me to try to do this myself in cpp using sfml, I originally saw this video when it was live in 2016 and tried to implement in cpp without coming back to this vid. It was a lot of fun to practice some basic programming skills and learn a bit of sfml for graphics handling.
@Philgob
@Philgob 7 жыл бұрын
I am watching this but I literally have NO idea what's going on
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
+Philgob 😁
@RAIRAIIRAI
@RAIRAIIRAI 7 жыл бұрын
same xD
@jezd2223
@jezd2223 7 жыл бұрын
same!
@devolee8302
@devolee8302 7 жыл бұрын
Not alone.. unless you have some ideas by now.. LOL!!
@n00bie96
@n00bie96 7 жыл бұрын
1. I don't get why this popped on my recomended videos list 2. I clicked this because I'm curious (also after finishing 2 seasons of Mr.Robot and learned python 2.7 and 3 ish) 3. the fact that he's like he lost his mind and recorded this alone, gives me an image of what the average programmers look like
@glokta1
@glokta1 7 жыл бұрын
n00bie Lmao exact situation I am in. Where are you learning Python from and how far have you gone?
@n00bie96
@n00bie96 7 жыл бұрын
TechyBoyProductions what are the odds. I only took free courses from I forgot his name (zed something, look it up) also from a phone app 'Learn Python' (forgot the developer). Currently laying my fingertips on Object Oriented Programming and it's intrigued me in many ways. Also still need to memorize some syntaxes though. You?
@glokta1
@glokta1 7 жыл бұрын
n00bie Just KZfaq basically. I've learned the loops and all and now I'm just practicing by looking up exercises to do. Check out Automate the Boring Stuff with Python, it's a great book to learn python. It's for free on the author's website. Oh and I think you're taslking about Learn Python The Hard Way by Zed Shaw.
@Dude-kd3ey
@Dude-kd3ey 7 жыл бұрын
Lol Mr robot brought me here too xD
@123TeeMee
@123TeeMee 2 жыл бұрын
An interesting way of storing the array of cells in the snake would be the directions of each cell. To store them you just use 2 bits of data for each (e.g. as two booleans for east/west and south/north), and to draw the snake you would have a simple loop to move a cursor around based on the directions, drawing each cell. You would also need to store the location of the snake's first or last cell.
@S4sent
@S4sent 5 жыл бұрын
last moments were exactly like when you deploy to production 😂😂😂😂😂
@CaioDanielNunesSantos
@CaioDanielNunesSantos 7 жыл бұрын
I spent several days to do it in Assembly
@ScibbieGames
@ScibbieGames 7 жыл бұрын
Caio Daniel Nunes Santos why would you do that in assembly.. mad respect but it's not really necessary..
@CaioDanielNunesSantos
@CaioDanielNunesSantos 7 жыл бұрын
Scibbie / ǝıqqıɔS It's not necessary, but it's fun.
@CaioDanielNunesSantos
@CaioDanielNunesSantos 7 жыл бұрын
Haeral It's not a good language for everything, but it's one of the easier ones after BASIC.
@ScibbieGames
@ScibbieGames 7 жыл бұрын
Caio Daniel Nunes Santos I can understand it's fun, if you like doing that then I'm sure you'll be a great programmer. I tried to understand it . but my code never runs, but assembly is really cpu-specific which is a thing I don't like that much xD. still, MAD RESPECT
@CaioDanielNunesSantos
@CaioDanielNunesSantos 7 жыл бұрын
I'm not a programer, and I won't be. But I alays make it for fun. Follow me on Git Hub: github.com/caillouplus
@mrcoolgoat9391
@mrcoolgoat9391 7 жыл бұрын
lmao when he turned the volume down I turned it up just before
@pokortec9773
@pokortec9773 2 жыл бұрын
This is one of the best coding channels on youtube.
@NighthowlsMusic
@NighthowlsMusic 7 жыл бұрын
I love this video! It was incredibly informative and enthusiastic over something so tedious. I started to freak out at the 1 min mark. I started in Python but this has motivated me to start jumping into JS. Cheers!
@thesmileynoob
@thesmileynoob 8 жыл бұрын
Man you are amazing! Subscribed! Also its nice that you explain stuff along the way. Keep it up.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@Pathdrc
@Pathdrc 2 жыл бұрын
That is just like me when working under pressure, and wanting to explain things to the full extent, feeling like I don't want to leave anything hanging. For the edge of the play area, would you allow for wrapping to the other side of the play field, or death on impact? Could make it part of level selection - easy allows the snake to wrap and hard doesn't.
@alisonjannette3084
@alisonjannette3084 5 жыл бұрын
i found this so entertaining, i love your enthusiasm
@korujaa
@korujaa 7 жыл бұрын
Great, now do Battlefield code.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
Oh, live this idea!
@truekep
@truekep 7 жыл бұрын
in 10 minutes
@korujaa
@korujaa 7 жыл бұрын
TK TrueKep hahahaaaahahah
@FTWMFXD
@FTWMFXD 7 жыл бұрын
that works*
@justskillfull
@justskillfull 7 жыл бұрын
while(connected){ disconnect() }
@MunyokiKilyungi
@MunyokiKilyungi 7 жыл бұрын
Amazing dude. Please upload more videos. Can you do Tetris?
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
definitely will consider it!
@bYgfoot
@bYgfoot 7 жыл бұрын
really cool video it thought me a lot about java script I use the gamemaker engine and i'm really considering using java script
@professorspace3485
@professorspace3485 4 жыл бұрын
Doesn't matter whatever time you took. Best part is, you make everything easist for learners to learn! 😊
@granumuse7847
@granumuse7847 5 жыл бұрын
Man you are my hero!! You have coded so many things so far!!! Thank you!!!!
@solemnej6270
@solemnej6270 7 жыл бұрын
Ive only coded in computer class and i built a website that was total clickbait and it was super fun (but i cant code like this guy FeelsBadMan)
@srgiggity
@srgiggity 7 жыл бұрын
keep learning my dude. you'll get there
@adlanehichembriki1831
@adlanehichembriki1831 7 жыл бұрын
Trump Hates carrots dota fan?
@thehomierudy1190
@thehomierudy1190 7 жыл бұрын
I've never seen anything like this and have no idea what any of this stuff means or how's he's doing it but I'd love to learn how its very interesting. you've gained a new sub
@cipherhex
@cipherhex 3 жыл бұрын
I think I've watched every Coding Rainbow/Train/Cubana... I'm very glad Dan didn't keep with the timed format 👍 Its much more relaxing content to enjoy when he's not panicked up to the eyeballs 😂
@gendawg4584
@gendawg4584 4 жыл бұрын
Despite the time limit and building from scratch. You are really great at explaining. Better then most how to code tutorials....
@Heidjnejdihbwjdihnskdhbe
@Heidjnejdihbwjdihnskdhbe 7 жыл бұрын
Classic programmer/developer/coder ( whatever you prefer ), always underestimating the time needed. Think of a project and be like "hmm, ok I can nail this in 15 minutes", 30 minutes later, not yet finished, "why do I always do this!?!?!?!".
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
+John Doe so true.
@doodlemonstah5656
@doodlemonstah5656 7 жыл бұрын
him: "I don't really want to use 'death' as a variable name" me: uses death as often as possible
@zeynepakbay2819
@zeynepakbay2819 4 жыл бұрын
I want to be a programmer, when i first saw this i said omg this man is so cool! You inspired me so much!
@jeanniepaculba4384
@jeanniepaculba4384 3 жыл бұрын
I want to be a Professional Programmer, same as you😊
@zeynepakbay2819
@zeynepakbay2819 3 жыл бұрын
@@jeanniepaculba4384 lol now i am cashier at the market
@victorsaha557
@victorsaha557 4 жыл бұрын
Don't know much about coding, still came here to watch the snake. 🤣🤣
@Entertainer760
@Entertainer760 8 жыл бұрын
I'm not quite sure how I found you, but your channel is awesome! Keep up the great work! :) +1 sub
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@gentleasp6589
@gentleasp6589 Жыл бұрын
subCount++
@BakedBrotatoChip
@BakedBrotatoChip 7 жыл бұрын
I know nothing about coding but I enjoyed watching this for some, God knows why, reason
@culpritdesign
@culpritdesign 7 жыл бұрын
Maybe you should be a coder.
@BakedBrotatoChip
@BakedBrotatoChip 7 жыл бұрын
yikes
@Surfnet47
@Surfnet47 7 жыл бұрын
BakedBrotatoChip me too!
@chacalXXX
@chacalXXX 6 жыл бұрын
I don't know the FIRST thing about coding. Like, I wouldn't know where to start, I don't even know what a function is, I don't know what app you use to code on Java but I've just seen the whole video and I was cheering hard when you fixed one of the problems. I also got very happy about the fact that I had spotted a 'total' without 'this.' before you and was able to predict that it wouldnt work. Omg this is so exciting I'm go watch The Matrix
@carloscabrera8446
@carloscabrera8446 5 жыл бұрын
Started programming today, will share when I'm able to do it, love ur vids, keep it up:)
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Thank you!
@immortalgamerz5599
@immortalgamerz5599 3 жыл бұрын
Did u ever learn carlos
@tonewipera
@tonewipera 7 жыл бұрын
You totally remind me of myself when I am solving something in the code.... talking to my self like you do to us. Neat video.
@Juke172
@Juke172 7 жыл бұрын
tonewipera that's like rubber duck debugging. Really helps :D
@haider4899
@haider4899 7 жыл бұрын
FUCKIN hell. there's no way i can think of EXACTLY which methods I'd need beforehand. I'd add method as I need them. how are you able to do it? are you on drugs? did you plan it beforehand? i think you did.
@baqikenny
@baqikenny 7 жыл бұрын
cocaine is a hell of a drug son
@haider4899
@haider4899 7 жыл бұрын
yeah, i never fuck around with JavaScript graphics stuff but I'm slowly getting into it. seems like he's also pretty familiar with the p5 framework. I'll have to read the docs, like for 20 mins before I can draw a single rectangle.
@baqikenny
@baqikenny 7 жыл бұрын
candh he's probably a teacher lol
@baqikenny
@baqikenny 7 жыл бұрын
Demonism yeah all the confidence and passion with his job haha
@baqikenny
@baqikenny 7 жыл бұрын
Demonism just like your name
@looch95
@looch95 5 жыл бұрын
I love how much you explain your code, really helps us beginners, especially the diagrams.
@cannabisanomaly
@cannabisanomaly Жыл бұрын
What an absolute madman and even more-so, an icon. I can only hope to have an iota of your brilliance at any given time in my life
@Ergoperidot
@Ergoperidot 7 жыл бұрын
I'm currently 19 and thinking about majoring in computer science. I can only dream of the day I can do something like this...
@MrJeng300
@MrJeng300 7 жыл бұрын
Rin Tezuka well then start game programming as a hobby! I could make stuff like snake or simple platformers when i was 14 or so, just because i really wanted to make games! so many great tutorials and stuff online!
@MrJeng300
@MrJeng300 7 жыл бұрын
***** I'd say Java is a good start because you can make a LOT of stuff with it right out of the box, without the need for external libraries. Personally, I'd start with C nowerdays, to get a better grasp of the basics, but really, it doesn't matter as long as you do something.
@MrJeng300
@MrJeng300 7 жыл бұрын
***** I think it depends a lot on the type of person. For me, the beginning was pretty easy and I made small games with Java pretty soon. With some dedication and effort you can be coding games in like a week!
@MrJeng300
@MrJeng300 7 жыл бұрын
***** Yeah, I taught myself though and it was still a good experience. Nowerdays great tutorials on programming are everywhere! I did start with a youtube series that the creator nowerdays sells though, so it was indeed quite a good source. Anyways, you can always find help in forums and stuff if you need it!
@MrJeng300
@MrJeng300 7 жыл бұрын
***** Those drag&drop tools are a cool way for introduction, but if you actually wanna do something with programming later I would recommend learning a proper language. Many find python being a good way to start. I personally don't like python too much and started with visual basic and later Java myself, but that is totally up to you, really. You will learn more languages later anyways. If you wanna go the hard but possibly better way, I'd start with learning C. Getting a hang of pointers & memory management can be a huge boost in understanding what your code does. The biggest factor anyways, is that you do start. Make coding a habit, learn something new every week! Have fun!
@JaimewissnerCreate
@JaimewissnerCreate 7 жыл бұрын
"And I actually have a diagram", yup. That's a programmer alright.
@opetrescu
@opetrescu 5 жыл бұрын
You're the boss of cool nerds. Thank you for this!
@edi4360
@edi4360 4 жыл бұрын
I have no idea of most of the things you were talking about but it was really interesting.
@violencechildren7603
@violencechildren7603 7 жыл бұрын
Challenge Recuest... Online FPS game with realistic graphics in 10 seconds please
@dazzyx3644
@dazzyx3644 7 жыл бұрын
lets give him 11 seconds just cuz he has to make it online Kappa
Coding Challenge #4: Purple Rain in Processing
12:14
The Coding Train
Рет қаралды 1,9 МЛН
Coding Challenge #71: Minesweeper
53:46
The Coding Train
Рет қаралды 528 М.
Вы чего бл….🤣🤣🙏🏽🙏🏽🙏🏽
00:18
Meet the one boy from the Ronaldo edit in India
00:30
Younes Zarou
Рет қаралды 16 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
❌Разве такое возможно? #story
01:00
Кэри Найс
Рет қаралды 1,9 МЛН
What was Coding like 40 years ago?
29:05
The Coding Train
Рет қаралды 1,7 МЛН
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 1,7 МЛН
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
The World's Best Mathematician (*) - Numberphile
10:57
Numberphile
Рет қаралды 7 МЛН
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 876 М.
Apple ][ Coding Challenge: Fractal Tree
35:35
The Coding Train
Рет қаралды 370 М.
The Bingo Paradox: 3× more likely to win
30:15
Stand-up Maths
Рет қаралды 395 М.
I learned to code from scratch in 1 year. Here's how.
41:55
Thomas Frank
Рет қаралды 397 М.
Coding Challenge 181: Weighted Voronoi Stippling
28:59
The Coding Train
Рет қаралды 162 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,6 МЛН
Вы чего бл….🤣🤣🙏🏽🙏🏽🙏🏽
00:18