Coding Challenge
Can I build an interactive 3D Rubik's cube in Processing? Yes! Someday I hope to return to this project and add an AI solver! Code: thecodingtrain.com/challenges...
🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
Other Parts of this Challenge:
📺 Rubik's Cube - Part 2: • Coding Challenge #142:...
📺 Rubik's Cube - Part 3: • Coding Challenge #142:...
🎥 Previous video: • Coding Challenge #141:...
🎥 Next video: • Coding Challenge #143:...
🎥 All videos: • Coding Challenges
References:
📹 peasycam: mrfeinberg.com/peasycam/
🟥 I am the cube: iamthecu.be
🔗 Rotation matrix on Wikipedia: en.wikipedia.org/wiki/Rotatio...
Videos:
🎥 Code Bullet: • A.I. Solves a 55 x 55 ...
🎥 Matrix Transformations: • How to Rotate Shapes i...
🎥 Matrix Multiplication for 3D Rendering: • Matrix Multiplication ...
🔴 Coding Train Live 173: • Coding Train Live 173:...
Related Coding Challenges:
🚂 #112 3D Rendering with Rotation and Projection: • Coding Challenge #112:...
Timestamps:
0:00:00 Introduction
0:01:50 Code! Creating the cube
0:07:56 Adding a Camera With PeasyCam
0:11:44 Adding Colors
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: thecodingtrain.com/discord
💖 Membership: kzread.infojoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#rubikscube #rotationmatrix #peasycam #simulation #processing
Пікірлер: 326
I love how coding KZreadrs reference each other haha. Code Bullet just recommend you a few weeks ago (I've been subscribed to both for a long time).
@realchrishawkes
5 жыл бұрын
We all try to get around.
@watchableraven3517
4 жыл бұрын
Got the like count to PI! Congrats jacob.
@dr.dank5769
4 жыл бұрын
Hill Climb Racing, Right?
@antonellamorello6833
4 жыл бұрын
Hby
Starting the video with "so that was fake" on April 1st
Right as a start getting into the theory behind neural nets and maschine learning you give me new material. Very much appreciated!
It's funny how Code Bullet shouted you out a week ago and now you independently do the same a week later
Absolutely love watching your enthusiasm and success in coding these programs. Wish I had as much knowledge and skill as you do! Keep on chuggin!
In case you are still wondering why up and down are flipped. it's the processing gridding system. it considers positive y in the down direction. draw a line to see that yourself.
Been a long time Code Bullet fan and have found your content recently. Love your enthusiasm and the effort put into all your videos!
I love how passionate you are about what you’re doing. It is such a good energy and it motivates me to learn more and watch more of your videos. Keep it up, sir. Thank you and good luck.
As a cuber and junior programeer this is so enjoyable. Love you Shifman!
Can we just call the green side the invisible side from now on?
@NStripleseven
3 жыл бұрын
CoxTH yup
Really interesting to see what we can do with lines of codes,never thought a rubik cube can be made through it virtually.Really amazing!
I love all the sharing of other youtubers, I have been watching you for well over a year now. Find code bullet and begin watching him since his start. Keep the love going!
When there is something wrong, I love how quickly you tend to figure out the issue! By the way, could you do a challenge on the game arcanoids sometime? I think it would be really cool if you incorporated power-ups as well!
@ffggddss
4 жыл бұрын
Yes, he sometimes solves issues in real time; but sometimes, he cuts, takes an unknown time to figure out the problem then restarts the vid with remedy in hand, making it look like it was solved instantly. But this is a plus; it keeps the viewer's train of thought from getting derailed. And all in all, he's quite fast at all this. Fred
LOL i’m literally coding that for a project in school it will be a huge help ty
Super! The start of another journey/adventure I just know I'm gonna love! NB: In the original Rubik's Cubes, ca. 1979-80, the color arrangement differed slightly from the way it is now. At some point, for some mysterious, unknown reason, the yellow & blue faces swapped places. F'rinstance, you could orient the cube with: UP = white, DN = blue FRT = yellow, BAK = green RT = orange, LEFT = red That's still the way I think of the thing. Fred
That was an amazing intro! xD “Ahah!” “...that was fake.”
As soon as the video popped up I immediately though of code bullet!! And then you reference him lol I love his videos and it really drives me to learn more coding and AI related stuff and then love your channel for the explanation on just about every step which helps with how I learn!
Good luck with this project :) some tips: - The center of a face does not need to be aligned along all axis for the cube to be solved. In other words: the green side of the the cubie at the center of the white face is not required to point in the green direction. The same goes for the center cubie you made, but for all its 3 axis. - There are configurations of the rubicks cube that are 'unsolvable'.
@jorgenfischer
5 жыл бұрын
Yes, but only if you randomly assign color to different faces. THe main issue i have with the way he is attacking this, is that f.eks: the color-combination of a certain corner will never change. It will always be red, green, yellow. I would have 8 corner pieces, 6 centers, and 12 edges. Color-code them correctly, arrange them correctly and start from there.
I'd say this is the most obscure and complex draw routine of the cube i've ever met. Maybe i'm not getting the ingenuity of the solution because of the further ideas of how the solver should process it but for now i'd call it counterintuitive.
I've failed to find a good rubik's cube simulator for the times when I'm missing mine. It's really enjoyable to watch you make it. I fucking love you! Keep it up!
Omg
I've just started to find situations at work where neural networks could be useful but I didn't know how to implement them, so I'm excited to see where this goes!
"I'll fix that up when I refactor that later" sounds like he'll absolutely never do that but ok
Wow im very excited for part 2, i would have never been able to to do thid
Processing is a great platform. ALL THANKS TO YOU for using this and also inspiring us to create great applications. I wish I had known it before.
hmm, i believe the terminology would be something like: (x, y, z) or (width, height, depth) or (columns, rows, layers)
Best coding video !! Keep it up
thanks for making programming looks fun!!
fantastic teacher! hope to see you soon:) here from japan.
Hey Dan, I'm currently going through your "Programming with Text" playlist but I encountered a problem on this video: "1.4: Getting Text from User: Loading a Text File". My code works fine and is shown on the console perfectly but the page won't show it (the page is just blank). Do you know why this is happening? I'm running a node HTTP server as you showed in a previous video in the same playlist. I'd really like to continue watching the next videos but I don't want to skip this lesson. Could you help me out?
I coded this too, in the 80s on a VIC20! I still love the topic.
because of this, i'm starting to love programming. oh god!
17:58 You're just like a pirate xD "ARR"
petition for making this guy the president
It might have been easier to instead of thinking of white as top yellow as bottom green as front blue back etc. to instead think of white always being opposite yellow. Blue always being opposite green. Red always being opposite orange. There is no real “top” of a Rubik’s cube. “White being top” is just a convention for new cubers to learn to solve the Rubik’s cube. When I learned green was top This also might make implementing the solve easier by allowing the computer to determine the most efficient top. Meaning, white only has a 1/6 chance of being the most efficient cross to solve. Might be a good project for us to implement later or something that happens if you ever decide to refactor this later.
@0cs025
5 жыл бұрын
but you also run into the problem like what happened in the video where the colors red and orange are swapped in positions even though they are still opposite to each other, though it would still look like a rubiks cube, it doesn't resemble the actual real life rubiks cube.
@zacharymcarthur9013
5 жыл бұрын
Joshua Ocso that wouldn’t be a problem as long as you rendered the cube correctly. I agree the first time you have to make sure it resembles a legit cube. However after that the code isn’t going to rewrite itself. It’ll stay that way then Up, down, left, right, front back are variables open for movements. Which is more in line with cubing. U/D/L/R/F/B are moves. Not colors.
0:28 it's so funny that I coincidentally did the very same thing. My best time is 54 seconds, but right now I learn to do first 2 layers differently so my average has dropped by 30 seconds or so :)
Lovely video, I got a challenge for you: draw an atom animation! :D
I heckin love this
Code Bullet is definitely a channel I would recomend with no doubt
You are a comedian. I always enjoy your videos and learn a lot in the process. :-)
I have already watched the livestream why am I here XD
@CYXNIGHT
5 жыл бұрын
I recognise all of this XD
@kupermen5567
5 жыл бұрын
Haha yeah
@chromawav8187
5 жыл бұрын
Same I had an intuition x)
I'v recently finished coding a program that can solve a cube in the sameway a humain does it, so this series is going to be really interestin to me
Daniel: Makes a program to solve rubiks cube Daniel: I dont know how Java works
Great video! Thanks, I noticed that you just could write. "float offset = len" because dim=3, so (dim - 1) * len * 0.5 = len
hahahahah. useful for our project. thanks hahaha I learned and had so much fan hehehe, I'm Rubik's Cube Solver tooo for around 6 years
Lol I independently found code bullet, then later as I got more interested in programming, found you... I didn’t see his video until now, and I’m not seeing your video until now... crazy how things work out isn’t it?
I tried making a rubix cube with 27 pieces which would all have an initial position and pattern. Each piece will either go up/down or left/right. On each rotation, 8 pieces are moved. Corners can have 8 possible locations with a few rotations to them.. Morale of the story is I need a giant whiteboard to draw out this logic lol.
I want to try to make a controlable version. In your part2, what controls will you use?
That's Great! Very positive!
I have a question that I havent seen posted below. Ive figured out how to bring the code together into a pde file to use in my web page but when it comes to a library like peasycam I run into problems. Ive tried to find maybe a cdn for peasycam or other processing libraries with no success. Is there a way to import these processing libraries into a html page?
Make a video about threads in processing or p5.js. I think, it would be interesting to know how to solve different problems sing threading.
veo estos vides para practicar ingles y al mismo tiempo conocer mas acerca de la logica de programación 😁
I love this, especially that you're using Java cause I'm actually learning Java now and this is helpful
@jakubsebek
5 жыл бұрын
There are some differences between Java and Processing tho
@S197Bryan
5 жыл бұрын
@@jakubsebek Yeah I noticed that. But the syntax is still very close which is great cause I am able to understand everything he is doing. I want to get into processing but I'll do it when I learn more java.
hello love this vid thanks for starting me to do coding
Just coming across this and being subscribed to code bullet. Shout out
This guy would be the most loved teacher ever
Very nice, I have to learn Java for university and I decided to look for something more interesting that we have to do at university and I found your video.
is color included in processing java(jar version) thats available for download? I downloaded 1.5 i think from the eclipse example project and color is not there
Yay!!
Waiting for the project of the rubiks cube to be complete. I like this puzzle explodes my mind more with programming a beauty. My Record is 13s. But my average is 19s to 23s
at 11:09 i used: float offset = ( dim * len) / 3; This also works to center the cube...
@samsloot
4 жыл бұрын
Why are you (and he) doing it like that? dim = 3, so you are just saying 3* len/3, which is equal to len. Why not just use len as offset, instead of calculating it?
@ffggddss
4 жыл бұрын
@@samsloot As I said in my reply to your other comment, dim won't always be 3; it can also be 2, 4, 5, 6, ... for cubes of other sizes. And Hans' formula won't work unless dim is 3, so Coding Train's formula *is* needed for the general case: offset = (dim - 1) * len / 2 Fred
@samsloot
4 жыл бұрын
@@ffggddss thank you!
@ffggddss
4 жыл бұрын
@@samsloot You're welcome. Of course, for cases other than dim = 3, lots of other parts of this code would have to be re-written, anyway. But that's Coding Train's wheelhouse (or rail yard?), so, no problem! Fred
Great bro that was amazing
Will it be wise to use your intelligence series to start machine learning or do I need prerequisites
I usually refer to the Z-axis as "bays" (vs rows and columns), but I have no idea if that's right or where I picked that up.
@diamondsmasher
3 ай бұрын
Depth?
These new Raspberry Pi 5 are hardcore. I have my youtube at 1080 for coding train and processing open on a 4k tv. this 3d cube may be smoother than my nvidia 770. these things are amazing.
When the next video will be? I am curious how you could do the rotations by dragging your mouse (the step were I left a year ago with this project based on html and css)
@TheCodingTrain
5 жыл бұрын
Going to try to do the next step on Wednesday this week!
Dan I was hoping you'd put the Coding Train logo/icon on the middle piece of the white face. I tried to Super Chat it but there was a problem with Google taking my credit card. Anyway, love the content as always.
@TheCodingTrain
5 жыл бұрын
Oh! Fun idea, maybe I'll do that in the next part.
Have y done fence animation?
Plot twist : Code Bullet is actually the Coding Train
I love the the intro 😁 Aha! 😎
I've been working on my own Rubik's cube app in JS, and it's cool to see your approach to it. If you want to draw inspiration from it or critique it, it's on wayofmath.com (no ads, so no revenue). I made it in three.js. It is less about simulating the cube and more about teaching how to solve it. I want to add the ability for the user to use their webcam to input their cube, and be shown how to solve their particular case. So I've been watching your color/motion detection videos to figure that out.
Yeah i love CODE BULLET!!
can peasycam work for c++ related coding projects just wondering, thanks!
Which IDE do you u use for your programming bro??
I want this to be a series on netflix.
Hey, i just watched your Coding Challenge about the QuadTree... i was wondering if it really makes sense to store points in a Quadtree which was already subdivided. Your goal is to only consider points which are in a certain area, so you lookup all the points of the quads which are within this boundary/area, but if you store points in the quadtrees which was already subdivided, for example the one which covers the whole width and height of your canvas, you also lookup points there which don't belong to this area. So shouldn't you remove the points from the quadtree which will is about to be subdivided and pass those points to the childrens, so they store those points. I'm sorry for my bad english, but i hope you know what i mean
@MaxPicAxe
5 жыл бұрын
I think he noticed this mistake after uploading this video, if I remember there were a lot of comments about it. But why comment here xD
21:00 use your math and you be able to use loops for example in y-fixed and color dwn we have sqrt(2)cos(5*pi/4)*r , -r , sqrt(2)sin(5*pi/4)*r sqrt(2)cos(7*pi/4)*r , -r , sqrt(2)sin(7*pi/4)*r sqrt(2)cos(9*pi/4)*r , -r , sqrt(2)sin(9*pi/4)*r sqrt(2)cos(11*pi/4)*r , -r , sqrt(2)sin(11*pi/4)*r ad we are able to construct the loop
Cool, now make a four by four
I've just started learning to program with a CS50 course at edX a couple weeks ago. So while I understand some of the terms, I'm having a hard time understanding the concepts. I have no clue how he knows what to do, or how to express it. And the frustrating part? I can solve a Rubik's cube with one hand in less than two minutes. lol
@PMA_ReginaldBoscoG
10 ай бұрын
It's just programming jargon; try to watch videos by Indian CS lecturers. They may help you a lot.
The coding train:lets take G as 1 Newton:Am I a joke to you?
i'm so glad that you thought me that the single square are called cubies
Awesome🤗
Would it be maybe Rows, Columns, and Tables?
PART 2 PART 2 PART 2 PART 2 PART 2 PART 2 PART 2 this is not binge watching on netflix :(
code bullet and shiffman! wholesome
Just a quick question: is this a solver as well, and if so, how do you plan to program a solver if you barely know how to solve it yourself? Nothing personal, but the methods commonly used for machine solving are quite complex, and I think you'd need a fairly deep understanding of how the cube works to program that from scratch.
@TheCodingTrain
5 жыл бұрын
Excellent question! There is a very likely possibility I will fail. I'm hoping to try to apply machine learning methods .. so rather than follow a known algorithm Im going to try to teach the computer to find a solution using a combination of genetic algorithms and neural networks.
@christiant.g.994
5 жыл бұрын
@@TheCodingTrain Don't really know much about implementing neural networks in coding, so hopefully I will have a lot to learn. Would be really awesome if you manage to build a solver like this :D
My regular gaming desktop is usually never off. the last 30 days it's almost never been on over the Raspberry 5.
781-0 Like Ratio, this just sows how good of a youtuber you are. :) keep doing what youre doing
@TheCodingTrain
5 жыл бұрын
I've got a dislike now thank goodness!
@raghavkamath
5 жыл бұрын
The Coding Train Well sir don't worry about those unnecessary dislikes, use them positively to work harder next time :-)
The intro 😂
The green screen headband has a new brother, the green square lol
Great video.
Why don't do a Video with Code Bullet? Maybe a Challenge where there is one specific Problem or Task and the one with the best/fastest solution wins :) I would Love to see that
@leonk6950
5 жыл бұрын
It'd have to be super funny, having shiffman just normally talking in front of his Greenscreen and codebullets avatar jumping around him 😂😂
APRIL FOOOOLLLLS!! He isn’t gonna change the inside colors 🤫😈
wish you millions and millions
"It's actually just an integer." *gasp*
@thetastefultoastie6077
5 жыл бұрын
barbaric!
Half an hour...well okay I do it in 10 seconds but you have a Rubiks brand so I don't blame you(great program btw)
Can you make a videoplayer like youtube with dynamic auto adapting?
In which platform do you code
Is this only possible in Java or can it be done in C++ as well?
U rock