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: kzhead.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
I love how coding KZheadrs reference each other haha. Code Bullet just recommend you a few weeks ago (I've been subscribed to both for a long time).
We all try to get around.
Got the like count to PI! Congrats jacob.
Hill Climb Racing, Right?
Hby
Starting the video with "so that was fake" on April 1st
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!
Right as a start getting into the theory behind neural nets and maschine learning you give me new material. Very much appreciated!
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.
Can we just call the green side the invisible side from now on?
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!
As a cuber and junior programeer this is so enjoyable. Love you Shifman!
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!
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
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!
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
"I'll fix that up when I refactor that later" sounds like he'll absolutely never do that but ok
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!
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.
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'.
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'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!
LOL i’m literally coding that for a project in school it will be a huge help ty
That was an amazing intro! xD “Ahah!” “...that was fake.”
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
hmm, i believe the terminology would be something like: (x, y, z) or (width, height, depth) or (columns, rows, layers)
fantastic teacher! hope to see you soon:) here from japan.
I coded this too, in the 80s on a VIC20! I still love the topic.
Wow im very excited for part 2, i would have never been able to to do thid
thanks for making programming looks fun!!
Best coding video !! Keep it up
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.
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.
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.
because of this, i'm starting to love programming. oh god!
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 :)
I want to try to make a controlable version. In your part2, what controls will you use?
I have already watched the livestream why am I here XD
I recognise all of this XD
Haha yeah
Same I had an intuition x)
Code Bullet is definitely a channel I would recomend with no doubt
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.
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
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
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
I heckin love this
Lovely video, I got a challenge for you: draw an atom animation! :D
You are a comedian. I always enjoy your videos and learn a lot in the process. :-)
17:58 You're just like a pirate xD "ARR"
I love this, especially that you're using Java cause I'm actually learning Java now and this is helpful
There are some differences between Java and Processing tho
@@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.
That's Great! Very positive!
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?
veo estos vides para practicar ingles y al mismo tiempo conocer mas acerca de la logica de programación 😁
This guy would be the most loved teacher ever
Great bro that was amazing
hello love this vid thanks for starting me to do coding
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
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.
Depth?
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.
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.
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?
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)
Going to try to do the next step on Wednesday this week!
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
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
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
at 11:09 i used: float offset = ( dim * len) / 3; This also works to center the cube...
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?
@@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
@@ffggddss thank you!
@@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
I love the the intro 😁 Aha! 😎
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
It'd have to be super funny, having shiffman just normally talking in front of his Greenscreen and codebullets avatar jumping around him 😂😂
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.
Just coming across this and being subscribed to code bullet. Shout out
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?
PART 2 PART 2 PART 2 PART 2 PART 2 PART 2 PART 2 this is not binge watching on netflix :(
Will it be wise to use your intelligence series to start machine learning or do I need prerequisites
Awesome🤗
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.
Oh! Fun idea, maybe I'll do that in the next part.
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.
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.
@@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
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.
781-0 Like Ratio, this just sows how good of a youtuber you are. :) keep doing what youre doing
I've got a dislike now thank goodness!
The Coding Train Well sir don't worry about those unnecessary dislikes, use them positively to work harder next time :-)
Yeah i love CODE BULLET!!
can peasycam work for c++ related coding projects just wondering, thanks!
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
It's just programming jargon; try to watch videos by Indian CS lecturers. They may help you a lot.
Which IDE do you u use for your programming bro??
Can you make a videoplayer like youtube with dynamic auto adapting?
I want this to be a series on netflix.
petition for making this guy the president
Would it be maybe Rows, Columns, and Tables?
i'm so glad that you thought me that the single square are called cubies
Have y done fence animation?
wish you millions and millions
The intro 😂
APRIL FOOOOLLLLS!! He isn’t gonna change the inside colors 🤫😈
Great video.
"It's actually just an integer." *gasp*
barbaric!
code bullet and shiffman! wholesome
The coding train:lets take G as 1 Newton:Am I a joke to you?
Yay!!
1:08 That's actually an april fools joke. He took a 15x15 and restickered it to look like that The actual records are 17x17 (now mass produced), 22x22, and 33x33
It was actually a 13x13 resticker mod
My regular gaming desktop is usually never off. the last 30 days it's almost never been on over the Raspberry 5.
Plot twist : Code Bullet is actually the Coding Train
Is processing and p5.js the samething?Can you do a video on it please?
p5.js is a javascript library. Processing is a java development enviorment.
I did one! kzhead.info/sun/dNGlcc2DqpuvY6c/bejne.html
Code a cube is an interesting project to be sure. Check out my attempt from 2018: kzhead.info/sun/ealmer1ohaFthn0/bejne.html
I was trying to implement this in P5, but sadly QUADS mode isn't implemented on WEBGL. Anyone has worked arround this?
this guy is awesomely smart
I love cubit
Is this only possible in Java or can it be done in C++ as well?
i have an error " OpenGL error 1280 at bot beginDraw(): invalid enumerant" how to fix this, thank you