I like the fact you aren't afraid to show where u made mistakes or got confused. Good explanation.
@realcygnus8 жыл бұрын
directly from the P5 included Examples, you can make a 2D array very much just like as in c, as follows; arr = []; in globals (as per usual), then just: for (var c = 0; c < cols; c++) { arr[c] = []; //ah ha !!! for(var r = 0; r < rows; r++) { arr[c][r] = random(255); }//4r }//4c seems you can declare it empty with arr = [[],[]]; but you need line 2 anyway. works like a champ !
@iphyzll10918 жыл бұрын
You are so positive and helpful, i love your tutorials ! Please keep it up, thanks ! :)
@TheCodingTrain8 жыл бұрын
+iPHYZLL , thank you!
@maxlesin38763 жыл бұрын
I will never stop thanking you for this knowledge.
@lucasjacinto84404 жыл бұрын
Thank you so much dude these two dimensional arrays were giving me trouble.
@flopasen2 жыл бұрын
i'm learning this stuff right now for a little project and really appreciate being shown the primitive things and ideas for a function
@Zachucks4 жыл бұрын
The Coding Train lost his train of thought lol! New fav channel btw, very good teacher and nice charisma!
@GabrielDalposso4 жыл бұрын
THANK YOU SO MUCH, I WAS SO LOST WITHOUT THIS
@taljune1420105 жыл бұрын
Thanks a lot Daniel! this is the only workable method for multidimensional array. It works for 3 dimensions as well.
@shreddymetal8 жыл бұрын
I've seen people use these weird 2 dimensional arrays before and I never knew it was a common thing, thanks for this!
@TheCodingTrain8 жыл бұрын
thanks!
@danbo9677 жыл бұрын
They are pretty common in a lot of areas like database (array of posts has an array of comments). If you work with JSON you will find 2D arrays all the time. When doing game development you use 2D arrays for positioning objects. Each array in the array of positions stores [x,y] sometimes [x,y,z]. Those are a few cases that I remember right now. But they are all over the place.
@johnn43146 жыл бұрын
Very solid educator
@mirankamal54318 жыл бұрын
You the best.
@TheCodingTrain8 жыл бұрын
thank you!
@younesbav0up3162 жыл бұрын
that was so helpful and you made fun to watch
@Popfictn8 жыл бұрын
Dan, i want to be able to fill with a specific color in the 2d array as opposed to a random one. How do i identify and fill a square with a specific colour? Thanks :-)
@shakyafernando33125 жыл бұрын
How do you target each individual box on the grid? (for example: if need to colour a specific box red)
@FredoCorleone6 жыл бұрын
Cols and rows are conceptually inverted, isn't it?
@TheCodingTrain6 жыл бұрын
It's a good point. I've always done [cols][rows] b/c of being so used to (x,y) but the more I teach about matrices the more I see the convention of rows x cols. This is a recent discussion: github.com/processing/processing-docs/issues/676
@kreendurron7 жыл бұрын
Daniel can you re-visit this topic in future videos?
@Halo4envivo7 жыл бұрын
the source code for this tutorial is not on github, can you put it again? or tell me where is it, if it actually is on github but i didn't see it, please
@NooblantisDistrict3 жыл бұрын
2022 and still saving lives✌😂
@Korsasnoraven5 жыл бұрын
Thanks so much for the video!!
@melodyhynes99045 жыл бұрын
So, say a 40x40 array of 0's and 1's to decide if content is locked or not (if 1 unlock content if 0 lock content) is there a better way to do this in terms of efficiency ? Say you call the array 'journals' and check the entire array for 1's and 0's to see if the corresponding place in the timelin (canvas drawn interactive timeline that shows the journals obtained) Is unlocked
@Es.me446 жыл бұрын
You can use console.table(arr);
@codeandfood6 жыл бұрын
'Command + Shift + T' on MAC will open your last closed tab :)
@TheCodingTrain6 жыл бұрын
Thank you Jeesun!
@oskar15044 жыл бұрын
I "hoped" i learn something new and realized i already using 2d arrays without knowing about this as an used method.
@cap-advaith5 жыл бұрын
hey dan is it like [row][column]............but u were saying [column][row].....why is that
@angladephil6 жыл бұрын
Hello. What if Idon't know in advance what number of cols and rows I will need ?
@martinkubat91933 жыл бұрын
Thanks. Perfect explanation. I missed step array[i] = [] in my code, used array[i][k] = x instead right away and it didn't work out. It's weird you can't initialize size of array in JS
@danaililiev14045 жыл бұрын
thnx so much solved my problem
@saipanda8936 жыл бұрын
What shortcut key you use for remove the comment into code ?
@TheCodingTrain6 жыл бұрын
Command slash!
@pittyconor24895 жыл бұрын
Blocks[i] = []; i did this but it says Uncaught TypeError: Cannot set property '0' of undefined (sketch: line 61)
@TheChodex6 жыл бұрын
I think i will stick with making array[width*height] and then just using array[ y * array_width + x] formula :P Seems like less of a hassle :P
@dzhellenicpoetry8 жыл бұрын
Nice! Thank you!
@noelearlwatson27248 жыл бұрын
Nice video
@TheCodingTrain8 жыл бұрын
thanks for watching!
@Metal5658 жыл бұрын
Thanks Dan, is there going to be a video on objects in 2D array?
@TheCodingTrain8 жыл бұрын
Great idea for a follow up, feel free to suggest! github.com/CodingRainbow/Rainbow-Topics/issues/100
@WistrelChianti2 жыл бұрын
thanks! That helped!
@d_06snehalprajapati90 Жыл бұрын
Good explanation....>3
@mathis-meth42292 жыл бұрын
he feels like paul gilbert(guitarist) of programming
@Sleep_Attenuation3 жыл бұрын
you are amazing
@calderarox8 жыл бұрын
can you make a video about collision AABB and how to react to it?
@TheCodingTrain8 жыл бұрын
Feel free to suggest: github.com/CodingRainbow/Rainbow-Topics/issues
@Samuelfodao8 жыл бұрын
AMAZINGGG!!!
@TheCodingTrain8 жыл бұрын
thank you!
@peterrempel24583 жыл бұрын
Thank you very much. It makes me satisfy to see, that an profi say what I'm thinking the last days and hours of learning: These f*#! moredimensual arrays confuse me :)
@TheAliakbarazad5 жыл бұрын
You Sir are pure goodness!!
@rorothegoatboat2 жыл бұрын
didn't get the same result, random is not a function error is what i get
@Blindstick13 жыл бұрын
Thank you!
@nicholarucitadhamma60002 жыл бұрын
I want to give a suggestion. Tho I'm 2 years late😅 But if you want to reopen a tab you closed, you could open your web browser and press Shift+Ctrl+T it should work. If it doesn't then, well I don't know.
@cap-advaith5 жыл бұрын
hey dan could u slow down a little bit a tiny bit ........because my video slow down button is not working......:-)
@gardeningandcooking51456 жыл бұрын
would you willing to write a js for me? I have been looking for someone who can do a small job for my website.
@lastskynet43465 жыл бұрын
code line 8 ----> 10 Error detected i = rows j = cols for every cols of rows
@tomvos33177 жыл бұрын
but the real question is: can you make a 3D array? seriously, can you make one? im interested :P
@TheCodingTrain7 жыл бұрын
Yes, any dimension is possible, they are really just arrays of arrays.
@tomvos33177 жыл бұрын
The Coding Train So in theory you van make An 123456789D array if I'm right :P BTW, I love your tutorials! They are really helpful, and they have got me into p5.js, which I never heard of until I saw your video's!
@klevisimeri6073 жыл бұрын
Love you
@valentinab.7423 жыл бұрын
hi! where i can find the code?
@snigdharahman14803 жыл бұрын
Sir can you teach me pointers * or guide me to a good like with your qualitY. I struggle with it a low
@goldthumb2 жыл бұрын
You, I mean "me", have to learn fundamental things before you start building your own stuff in a reasonable speed. 2D array is fundamental.
@abhishekkattimani13026 жыл бұрын
Sir could you make the java video tutorial series right from basics.. please please..
@Alebtong17 жыл бұрын
I am confused
@FredoCorleone6 жыл бұрын
Confusion means you are learning
@latorious94894 жыл бұрын
Python is just so much more simple Method: arr = [[random.randint(0, 1) for y in range(Rows)] for x in range(Cols)]
@chancewoosley31654 жыл бұрын
i love you
@WILPOLLOCK2 жыл бұрын
Your whiteboard is crooked. It's hurting my brain... 🤣
@bourbon35873 жыл бұрын
I just losing my concentration because of laughing(over ),shaking of hands and body
@Human_Evolution-2 жыл бұрын
Too sporadic.. Screens zooming all over.
@lucanghuang82013 жыл бұрын
First time I watched this...very confusing.
@RigelNarcissus8 жыл бұрын
let make2Darr = function(r, c) { return new Array(c).fill([]).map(e => new Array(r)); } ;)
@TheCodingTrain8 жыл бұрын
oh wow, mind blown. github.com/CodingRainbow/Rainbow-Topics/issues/100