A.I. Solves a 55 x 55 x 55 Rubik's Cube

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
oh yeah get keen today i would like to present to you the thing which has been monopolizing my life for the past two weeks i've been coding my ass off for this with over 40 hours of coding to condense into one video for you guys this project was inspired by this video here and i don't make a habit of copying other people's content but you can probably already tell my reasons don't get me wrong i think this video is really cool but man do us all a favor have a few more [ __ ] pixels happening please you're trying to show a thousand by thousand rubik's cube in 480 pixels it's not gonna work i did the math it's just not gonna happen and i hate to be this guy but this does look suspiciously like a random scramble played in reverse oh wait never mind he says it himself at the end of the video that it was algorithmic and nobody lies on the internet right i mean sure he doesn't say what algorithm he uses nor does he link to any source code in the description it doesn't really look like any algorithm that i'm aware of and this channel isn't even a coding or rubik's cube related channel it's a [ __ ] music channel but that's just me being overly critical and skeptical i'm sure it's an algorithm anyway so that's what we're going to be attempting i mean i probably won't be solving cubes this big but then again neither did apple zerg sick burn evan shut up and start coding fine okay first we've got to make the damn rubik's cube nothing flashy just a bunch of colored cubes stacked on top of each other you get the points [ __ ] rubik's cube hell yeah awesome i also made the code able to generate a cube of any size so let's see how far we can push this we got 20 we got 30. [ __ ] it let's go for the big hundo oh that's awesome although my computer isn't loving it as much look at that frame rate i didn't try a thousand by thousand rubik's cube but my computer had a stroke so i'm not gonna try to do that again anyway so we got some cubes let's get them moving to explain how i did this i'm gonna need to get technical so the standard rubik's cube has three three by three tables or matrixes representing the blocks and this is all well and good while they're not moving but unlike a physical rubik's cube you can't just spin them it's really not how it works the matrix remains stationary so we have to take each block out of the matrix and then put it in its new position in the matrix so here's how i did that first i got the values of the matrix in a circle kind of shape to make a list then take the two values from the back and shine them to the front of the list then convert the list back into the matrix and boom we gotta turn okay let's code that [ __ ] all right too easy here we go yep that's looking great and it's [ __ ] fantastic okay um yeah okay that let's let's fix that yeah let's fix that all right beautiful there we have it but we don't want the cube to rotate instantly we want it to turn slowly so it looks actually like a rubik's cube this is actually pretty simple just a matter of actually rotating it but yeah here it is very nice okay so we've got a rubik's cube going too easy [Music] all right so now that's done we've got the pretty daunting task of coding an ai to solve this bad boy and if you think you were going to get through this video without learning how to solve a rubik's cube then you are probably right because i ain't teaching you [ __ ] now i will do my best to explain the basics of each steps involved but i can't go into too much detail about it otherwise this video would be literally hours long and we all know i can't be [ __ ] doing that anyway for any cube savvy people out there i'm going to choose the most basic method of solving a rubik's cube i'm talking beginner level [ __ ] i did this because i thought it would be the easiest but evan is a silly boy because this method was probably the hardest one i could have picked for an ai the more advanced methods of solving rubik's cube are considerably more difficult because they require you to analyze the cubes and apply memorized algorithms to solve the cube for anyone who hasn't met a computer before they're pretty great at analyzing memorization and algorithms so i kind of shot myself on the foot with a cannon by choosing the method which uses the least of these things if you're new here welcome to code bullet we do smart stuff in the stupidest way possible anyway to the soul step one is getting the green cross this step is generally considered the easiest when humans solve it because you don't really need any algorithms or anything anyone can pretty much pick up a rubik's cube fiddle around with the cube and get this part all they need to do is line up the green edges with their corresponding faces but you can't just tell the ai to fiddle with it and then figure [ __ ] out from there and i'm not going to bore you with the details of how i do everything so i'll just give you a peek into my mental state during this section anyway so that happened but it works now so yeah yeah they're in total seven steps to solving the cube so let's rapid fire through them so now that step one is complete we have the cross at the bottom next step is to chuck the corners into the bottom layer to complete the first face of the cube [Music] very nice okay now the next step is to position the edge pieces so that the second layer is finished [Music] now there's only the blue lady to go on the top and the trick here is to solve it without [ __ ] up any of our previous work which is much easier said than done so next step is to make a blue cross on the top there we go although our blue cross isn't fantastic as the edges don't align perfectly with the faces but you know what can fix that some of those sweet ass algorithms all right so yeah the next step is fixing that bad boy and oh we're getting close now boy next step we need to get the corners in the correct spots but not necessarily in the correct rotation there we go and finally we do some more cheeky algorithms to rotate them until they're correctly oriented and hell yeah we did it all right let's watch the whole thing through now [Music] oh yeah that's pretty dope but you know a three by three cube doesn't make for a very click-baity thumbnail so we are just getting started because next step is to go even bigger so how exactly does one solve a rubik's tube that is bigger than a three by three basically first you need to convert the massive cubes into a three by three and then solve it as a three by three on each face of a three by three you have four edge pieces four corners and a center on say a seven by seven you have kind of the same thing however the center piece is now 25 center pieces and each edge is now five edges so first we need to solve the center piece like this and then solve the edge pieces like this then we essentially have a three by three cube with four edge groups four corners and a single center group okay i kind of get it but how exactly do you do that with great [ __ ] difficulty my different blood sweat and tears went into this believe me okay maybe not technically any blood but i did have one hell of a sweaty cry you probably didn't need that visual but you got it anyway moving on same as before let's start with green so the general tactic is to create faces one column at a time and then slot them in to get the full face done so yeah here you can see a green column slowly being formed and then once it's done it's chucked in the bottom row but evan how exactly do you make these profound pillars of green goodness you watch a [ __ ] tutorial moving on so really the rest of the faces are pretty similar you just have to try not to [ __ ] up the [ __ ] you've already done which is a general rule of thumb of doing ruby scoobs that is until you get the final two faces then you can use some of those damn sexy algorithms to get that job done damn that's a good looking algorithm it switches the positions of one orange face and one white face so if you got an orange face where it shouldn't be one just switch it just switch it with that algorithm very nice okay we've got the faces done and now it's time for the edges again there's not much to say about the edges same basic rules apply just figure it out apply the algorithms don't [ __ ] up stuff you've already done and you'll be golden computer file okay now we've got the edges and the faces solved it's time to plug in the three by three algorithm hell yeah finally [ __ ] da okay so turns out this is what's known as a cheeky parody when you get this cheeky bugger it basically means you're [ __ ] mate no it's actually pretty easy to fix once you know the algorithm and it actually looks pretty dope on bigger cubes oh that's good looking algorithm okay with that done we have actually finished this beast of a project and it's time to show you what you're all here for the ai crushing some larger cubes let's go first up is 11 by 11. [Music] [Applause] [Music] so [Music] [Applause] [Music] [Music] [Applause] [Music] [Music] [Applause] [Music] [Applause] [Music] so [Music] [Applause] so so [Music] [Music] [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] so [Music] [Music] [Music] [Music] [Music] so [Music] so that was pretty awesome thanks for watching i hope youtube's compression algorithm didn't make it look like [ __ ] uh but anyway if you want me to do any bigger cubes i might need to improve the efficiency a little bit because this took [ __ ] ages the 55 by 55 cube took about an hour and a half to do um so yeah if i do any bigger it might actually become an issue time wise um but if you don't want to see that leave a comment if not then i'll see you next saturday with another video probably
Info
Channel: Code Bullet
Views: 14,637,719
Rating: 4.8500004 out of 5
Keywords: artificial, intelligence, coding, processing, java, machine, learning, genetic, algorithm, evolution, computer, science, programming, comedy, educational, rubiks cube, rubik's cube, puzzle, AI, epic, 3d, timelapse
Id: f9smvQ5fc7Q
Channel Id: undefined
Length: 15min 59sec (959 seconds)
Published: Fri Dec 07 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.