25% off Nature of Code with code CHOOCHOO: natureofcode.com (also includes exclusive sticker+bookmark!)
@vu_derArchitekt3 ай бұрын
🎉 I pre order the book in July (to Vietnam), waiting for your beautiful sticker and bookmark 😊
@TheCodingTrain3 ай бұрын
@@vu_derArchitektthank you for the support!
@unveil77623 ай бұрын
Ah finally I clicked!! But i forgot to apply discount LOL!! I always wanted to have that book, was so hyped !! THANKS!!!!!!!!!!!!each time i see one of your video ,i want to write a shader or do some procedural modelling 🙂
@farazk97292 ай бұрын
Maestro, I just preordered Nature of Code (love the color of the book BTW); I will get it on Dec 10 (I am based in Australia). In the meantime, would you recommend going through the old book? The one with Processing... I have read parts of it, but not the entire book. Would you recommend that or do you think the old book is no longer relevant? Thanks,
@TheCodingTrain2 ай бұрын
@@farazk9729 You could still read it yes, however, I'd recommend just reading the new one on the website until the physical book arrives! natureofcode.com/
@frollard3 ай бұрын
A friend of mine and I coded a version of this for the TI-83 calculator back in high school (holy crap more than 25 years ago)...his version was an insane recursive algorithm because of the memory limitations of the calculator - couldn't write a long list of the segments and do a simple transformation on it to double up and make the next segment. His algorithm actually drew the curve one line at a time...and determined the orientation of each arbitrary line segment up, down, left, or right - as the n'th line of the i'th iteration. That way, he could just draw that one line, then the next, then the next. One of the harder parts was scaling the screen coordinates so that line segments were integer multiples of the number of pixels available to prevent weird moire/aliasing patterns emerging.
@Manticore_0073 ай бұрын
The added visuals for explaining the code on-the-fly is an awesome addition! I love it
@felizdiacaro3 ай бұрын
I found your channel a few days ago and since then every time i have an idea and mention it to someone, a video of you doing it is recommended to me by youtube. that's kinda cool. i ordered the book and i look forward to trying out all this stuff. Thank you!
@TheCodingTrain3 ай бұрын
Thank you for the support and kind words!
@MrQuickLine3 ай бұрын
To get the last element, you can do Array.at(-1)
@69zwaan3 ай бұрын
Yes, last segement. Length
@MrQuickLine3 ай бұрын
@@69zwaan but splice creates a new array, where as .at just references the existing one
@4120_PRATIKRATHOD3 ай бұрын
pop() ! 😂
@captainexpo49253 ай бұрын
@user-sy4sf8gq4p pop() removes the last element as well as returning it.
@XellosTheDragon3 ай бұрын
@stio_studio not a trick, just brand new!
@cipherhex3 ай бұрын
If Dan doesn't lose his mind at least once, the Coding Challenge isnt worth watching! 😂 Love it as always!
@Ctrl-Z-Renders3 ай бұрын
The coding challange is ALWAYS worth watchig!
@thelavagod2 ай бұрын
Why does this guy never get old? Literally the only thing that changed (AFAIK) is the color of his hair. His style of videos is still the same as it was 8-9 years back.
@kerrykreiter4453 ай бұрын
That was a fun one to watch!!
@markuszeller_official3 ай бұрын
Hey Dan. Your book arrived. I LOVE IT.
@TheCodingTrain3 ай бұрын
Yay!! Thank you for the support!
@PatrickHoodDaniel3 ай бұрын
This is a good visual example of compounding.
@roballegarАй бұрын
This is great. I thought for sure you'd be using matrix multiplication to handle the rotation, but your way is clean and easy to understand too.
@orugma2 ай бұрын
I'd love to see more videos like the Apple ][ Coding Challenges. They were a refreshing change of pace. Or the ones where you worked in the shed.
@csabakiraly5794Ай бұрын
this guy is like the bob ross of coding
@RupertBruce3 ай бұрын
I would have thought that treating each line as a unit and the rotation as simple arithmetic of the number of units in each direction on the path, the problem becomes way easier to compute... Simple turtle movement!
@onebeartoe3 ай бұрын
I love you Dan. "Except for the very first time"!!!!!!
@r4co3513 ай бұрын
Yet another astonishing intro... Keep up the great work!
@findjonmoses3 ай бұрын
Dirtywave M8 is my dessert island instrument…get the MK2. It has a microphone and a bigger battery and a bigger screen. So worth it
@BrettCooper47023 ай бұрын
Line packing to remove lines that already exist / overlap in the array of lines.
@TheCodingTrain3 ай бұрын
Yes, good idea!!
@alessandrofenu43253 ай бұрын
I think it is easy to prove that this doesn’t happen
@Smoth482 ай бұрын
I am so glad I found this video!! I literally have the dragon curve tattooed on me :D And I drew *lots* of Hilbert curves in school haha
@aparrot42543 ай бұрын
Really cool video. Your way of reasoning and debugging seems smart. Talking out loud and kind of explaining the code. Reminds me of rubber duck debugging.
@corey333p28 күн бұрын
The math may not be as simple as you make it seem if you're on some platform that doesn't have a rotate function. For me it was a bit of a thinker to figure out how to apply the rotations. I came up with complex numbers. Format each point being rotated as a complex number, subtract out the point of rotation to transform the point of rotation to the origin, multiply the result by 0+1i to apply the 90 degree rotation, and reapply the transformation from 0,0 to the point of rotation.
@aedyngillion94572 ай бұрын
For the next tutorial could you do a soft body collision but with more in depth collision like the lines collide and it uses a bounding box and all that jazz
@rotten-Z2 ай бұрын
This problem can be solved by constructing an array of integers. The value of an array element is the direction of the "turtle" movement. 0-up, 1-right, 2-down, 3-left. At the first step, the array consists of one element, at each subsequent step, the length of the array increases by two times. The added part of the array is filled with values as follows: let N be the length of the array A at the current step. 1) increase the length of the array to 2 * N. Each A [i] element in the range from N + 1 to 2 * N - 1 receives the value A [i] = (A [2 * N-i-1] + 1) % 4. As a result, the right part of the array contains a mirror copy of the left part, rotated 90 degrees to the right. The operation (X + 1) % 4 is the rotation. The result is drawn by calculating the offset of the next point from the previous one in the direction specified by each element of the array A
@yujicortkristos38513 ай бұрын
I programmed it once in java by defining 2 functions calling each other. draw() draws a little segment and left() and right() are turning 90°. To start it just call draw() and f(n) right after it: private void f(int n) { if (n > 0) { f(n - 1); left(); draw(); g(n); } } private void g(int n) { if (n > 1) { f(n - 2); right(); draw(); g(n - 1); } }
@flashbond3 ай бұрын
If I were you I would store x and y coordinates of vertecies in a seperate array. Find the max values each time and divide them by 2. I would update my zoom and canvas center according to that.
@TheCodingTrain3 ай бұрын
I like this idea!
@flashbond3 ай бұрын
@@TheCodingTrain I am not a programmer. Just a hobbyist :) Your comment means so much to me 🙏 Animation speed may be also adjusted according to circumference of the whole rotating part. Some trigonametry may get involved :)
@enpeacemusic1923 ай бұрын
Can you do Newton fractals next? They're not strictly recurring fractals like you have been doing but it's still a really super cool fractal and worth looking into!!
@TheCodingTrain3 ай бұрын
You can add it here! github.com/CodingTrain/Suggestion-Box
@HarDarkable3 ай бұрын
This dot!
@md.nournoby45233 ай бұрын
The king of js in the planet
@elbananita22453 ай бұрын
love your videos! :)
@AmandeepSingh-ot5zf3 ай бұрын
hey I caught it in 16 seconds :D
@dhanupawar37723 ай бұрын
Hey Dan why don't you explain some popular generative art codes and how to make them, this is just for learning more from tou generative art community.
@geoffwagner49353 ай бұрын
he Billy Mayse'd the challenge with boom
@gower19733 ай бұрын
This went from done to car crash in about three minutes flat 😂
@69zwaan3 ай бұрын
Geweldig idee, maar je kan ook met image.copy =[] of cretegraphics is dat mijn goede idee?
@ryaneakins72693 ай бұрын
Don Knuth has this curve on his wall at home. There was a Numberphile video about it.
@rubensjoserosa3 ай бұрын
Hello, Dan! How are you!! Your work is wonderfull! I would like to know if you can ship you book to Brazil.
@TheCodingTrain3 ай бұрын
Can you search local online book retailers? It's being distributed internationally be Penguin Random House so you should be able to find it! Make sure it's the 2024 version and not the 2012 version. Let me know at daniel@thecodingtrain.com b/c lots of folks are asking!
@LoPhatKao3 ай бұрын
should add something for sale on your NOC site -- signed copies of the book even if it just said "thanks for the support! - Dan" i'd pay extra for it 😊 edit: buying one anyway for my birthday
@TheCodingTrain3 ай бұрын
Unfortunately I don't have an easy way of doing this, but I will be hosting events in NYC where I will sign the book!
@realcygnus3 ай бұрын
nifty
@adrien87683 ай бұрын
Hey, great video :) p.s, can you share the QUAD-Tree code please?
@dansxmods3 ай бұрын
Would love to buy the physical copy of The Nature of Code but shipping to Australia is $56 US and all up it would be just shy of $100 AUD, can you look at a cheaper option to ship to Australia pretty please?
@TheCodingTrain3 ай бұрын
This link should help! www.penguin.com.au/books/the-nature-of-code-9781718503700
@meeper183 ай бұрын
It’s always this.
@StinerDevHubАй бұрын
🎉🎉🎉🎉
@VVVVVVVVVVVVVVVVVVVVVVVVVZ28 күн бұрын
Que doido, achei que só mr beast fazia video dublado em portugues 🥳
@lordofthe6string3 ай бұрын
Is this what was in Jurassic Park?
@ranawaqas40802 ай бұрын
from 208 i seeing that you only work on p5
@adminiget16023 ай бұрын
Hi! Can you please make more videos on the Apple ][? Maybe TRY coding a platformer in it? Or graphics mode Snake?
@PMA_ReginaldBoscoG3 ай бұрын
The book is not available in India. Please do something 🙏
@TheCodingTrain3 ай бұрын
I’m going to ask No Starch about this. It’s being distributed by the publisher internationally! Feel free to contact them on their website also.
@piotrlesiakowski77943 ай бұрын
Is it a casio calculator watch? :o
@TheCodingTrain3 ай бұрын
indeed, good catch!
@-Dygex2 ай бұрын
can you make tornado :D
@thailonlucasart3 ай бұрын
Is there a way I can buy the book in Brazil?
@TheCodingTrain3 ай бұрын
I'm trying to make a list of all the international retailers that carry it for the website Can you find it on here? www.buscalibre.com/ If amazon will ship to you, it will likely have it as well. Let me know!
@TheCodingTrain3 ай бұрын
(Make sure when you look you don't buy the older 2012 version by accident. You can tell by the cover and the publication date)
@RicardoPrediger3 ай бұрын
I'm not the only Brazilian who loves this guy 🎉 I would also like to have this book. I'm a programming teacher and I've been using processing in my classes for 3 years. (BR) Eu não sou o único brasileiro que adora esse cara 🎉 Também gostaria de ter esse livro. Sou professor de programação e a 3 anos uso processing nas minhas aulas
@thailonlucasart3 ай бұрын
@@RicardoPrediger akakka Eu assisto o canal há anos! Nem sempre faço tudo oq ele mostra mas me divirto muito vendo ele programar kakakak Sou programador e venho aqui pelas aulas akkaka
@maltezachariassen74963 ай бұрын
You are technically drawing a lot of lines on top of each other.. you could optimize by removing duplicate lines
@lunyalina3 ай бұрын
Haven't watched it full yet, but wouldn't vectors be better than your own segment class?
@fachriem3 ай бұрын
hi there, could you please try game ‘The Farmer was Replaced’ its interactive coding base game using basic python to control the drone to solved maze