Coding Challenge

2024 ж. 9 Мам.
146 725 Рет қаралды

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 1: • 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 174: • Coding Train Live 174:...
Related Coding Challenges:
🚂 #112 3D Rendering with Rotation and Projection: • Coding Challenge #112:...
Timestamps:
0:00:00 Introduction
0:01:30 Continuing From Part 1
0:02:57 Representing Each Cubie In a Matrix
0:09:43 Finding Each Cubie
0:11:01 Applying Rotation
0:25:30 Coloring The Faces
0:33:59 Updating The Positions
0:40:33 Adding Directions For Each Turn
0:44:03 Testing If Everything Works
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

Пікірлер
  • offset = (3 - 1) * len * 1/2 ... that's a long way of expressing len, LOL

    @zl25drexel@zl25drexel4 жыл бұрын
    • Well we all make misstakes don't we. A prime example

      @albinwarme6109@albinwarme61094 жыл бұрын
    • offset = (dim - 1) * len / 2 is needed for the general case, where dim isn't necessarily = 3. For the 2x2x2, 4x4x4, 5x5x5, etc. versions of the cube. Fred

      @ffggddss@ffggddss4 жыл бұрын
    • @@albinwarme6109 *missteaks And no; some of us are perphict... Fred

      @ffggddss@ffggddss4 жыл бұрын
  • The cubies are called Corners, Edges, and Centers. Corners have 3 faces, Edges have 2, and Centers have 1. Another great video and I hope I can do something like this one day!

    @d0nnyr0n@d0nnyr0n5 жыл бұрын
  • I usually have absolutely no idea what's going on, but here I am sat watching for an hour. Cause he makes it interesting!

    @RaysOfPivot@RaysOfPivot5 жыл бұрын
    • It's obvious that he takes quite a while before he makes the video to figure it out beforehand... Which is great! Nobody is that brilliant of a programmer (maybe a small few).

      @jackmead7292@jackmead72924 жыл бұрын
    • @@jackmead7292 Doesn't he livestream it

      @puppergump4117@puppergump41172 жыл бұрын
  • Idea for a coding challenge: A Sudoku solver. Its probably not that hard, but I still want to see your approach. Greetings from Germany!

    @germancubesolveryolo4524@germancubesolveryolo45245 жыл бұрын
    • GermanCubeSolver YOLO good idea. Using recursion it's a fun one

      @rstewa35@rstewa355 жыл бұрын
    • Causally droppin those NP-Complete bombs

      @dankwarmouse6248@dankwarmouse62484 жыл бұрын
    • Sodoku isnt NP-Complete

      @oofusmcdoofus@oofusmcdoofus4 жыл бұрын
    • I attempted this once on my own. I tried to make a program that creates completed sudoku grids I got an algorithm together and let it run, but apparently it would have taken about six weeks to finish a single puzzle. Even doing it by hand with a pencil and paper is incredibly difficult. That would definitely put the challenge in Coding Challenge.

      @kevnar@kevnar4 жыл бұрын
    • DEUTSCHLAND!!!!!!!

      @Sirvierl0ffel@Sirvierl0ffel4 жыл бұрын
  • I love the way you explain your code as you write it. It makes it so much easier to learn and understand. Thanks! Awesome work :)

    @Kirkster@Kirkster5 жыл бұрын
  • Started watching your videos, and they are amazing, I learned some things about coding, amazing challenges you do!

    @xheptc9612@xheptc96122 жыл бұрын
  • This code is so much cleaner than what I saw in the live stream. Very nice!

    @ErikWouters@ErikWouters5 жыл бұрын
  • I learned a lot from you Like how you do small steps and test them And how you keep your mood high

    @fuzzy-02@fuzzy-023 жыл бұрын
  • The best one yet. Can't wait to see the animation.

    @garm0nb0z1a@garm0nb0z1a5 жыл бұрын
  • You, good Sir, are a coding beast. My head did a full pi matrix transformation the entirety of this series. But I learned what I came here to learn which was coding the math and fundamental application of the three dimensional arrays for this project. Thank you so very much. I love your teaching style. Watching you make the same mistakes that we all make and your grace and humility in debugging on the fly is truly inspired my friend. You are the man. 🤜🤛

    @Nervosa80@Nervosa803 жыл бұрын
  • Another thing that you could use to perform 3d rotations is quaternions. They are 4d numbers designed specifically with the idea of performing rotations in 3d space and are relatively easy to pick up. 3B1B had an awesome video about them and I think it would be very interesting to see quaternions in action

    @fotiskapotos@fotiskapotos5 жыл бұрын
    • Yes. SO(3), the rotation group in 3-space, has 3 dimensions; quaternions have 4. So the quaternions used for this are those that are unit length; i.e., the sum of squares of the components = 1. That constraint takes away 1 degree of freedom, leaving 3, to match SO(3). And the correspondence is 2-to-1, where any given quaternion and its negative both give the same 3-space rotation. Fred

      @ffggddss@ffggddss4 жыл бұрын
  • The best one hour video I have ever watched!!!!

    @iradnuriel9087@iradnuriel90875 жыл бұрын
  • so much for getting my course work done tonight..haha

    @RicoGalassi@RicoGalassi5 жыл бұрын
  • "Guess what i can turn it...uh..wait" - Programming in one line.

    @rohan1002@rohan10023 жыл бұрын
    • Rohan Gupta yes

      @le_plankton@le_plankton3 жыл бұрын
    • Here's programming in one line: SyntaxError: "Bro why are up its 3 am Error: No closing quotes.

      @noahnolte7288@noahnolte72883 жыл бұрын
  • this video helped so much in my school project. thank you so much!!

    @alksri@alksri3 жыл бұрын
  • This was the day I was waiting for where cubing and coding combine; Thanks!

    @Dhakshith1189@Dhakshith11894 жыл бұрын
    • Same!

      @sinpi314@sinpi3143 жыл бұрын
  • I love you!! You inspire me everyday and i wish i could have your energy and positivity

    @ttrouble1711@ttrouble17115 жыл бұрын
  • 20:53 Actually the middle layer is a move its called M :) You can do U perms, H perms, Z perms, or OLLs with M moves :)

    @richlai3378@richlai33785 жыл бұрын
    • The other middles are E for equator and S for standing. But there rarely used.

      @kesleta7697@kesleta76974 жыл бұрын
    • Although it's technically the same as a R and an L' or vice versa

      @kesleta7697@kesleta76974 жыл бұрын
    • @@kesleta7697 yes!! :)

      @richlai3378@richlai33784 жыл бұрын
    • These are also collectively called, "slice" moves. Fred

      @ffggddss@ffggddss4 жыл бұрын
    • His comment ¨it's not really a thing¨ shocked me. I'm using the Roux method :)

      @jansalomon5749@jansalomon57494 жыл бұрын
  • Near the end of the video, you set up Sequence with a random set of 10 moves in a loop with Sequence += blah. Then you set up a second loop that takes Sequence and reverses it into NextMove. But this seems silly to me to have two loops. You could do this all in the first loop with these lines: if (random) // rotate clockwise Sequence += blah NextMove = blah.UCase + NextMove else // rotate counterclockwise Sequence += blah.UCase Nextmove = blah + NextMove

    @djsyntic@djsyntic2 жыл бұрын
  • 5:10 Changing the i, j, k to x, y, z... That was awesome :)

    @luismiguelgallegogomez8000@luismiguelgallegogomez80005 жыл бұрын
  • I have got an amazing idea for getting to solve itself........ we can just add the key pressed values in a list and then when space is pressed we can just reverse that and it resolves itself Greetings from India!

    @ninjahyper5079@ninjahyper50793 жыл бұрын
    • I have done it and it works amazingly I can share the code also

      @ninjahyper5079@ninjahyper50793 жыл бұрын
    • just i couldn't do it in the animation thing that you had done in the 3rd video

      @ninjahyper5079@ninjahyper50793 жыл бұрын
  • Wow, nice. :D and this was my first processing project on my raspberry pi 5. Even got my git commits and everything down for this one

    @geoffwagner4935@geoffwagner49353 ай бұрын
  • Hats off 2 u..I just loved the codes u wrote..

    @roshan_singh5709@roshan_singh57095 жыл бұрын
  • J'adore ! I watched the whole rubiks one video and I thought: Oh damn how he'll achieve to code through this? When I started vidéo 2 I laughed so hard :D I'll refactor this!

    @airxperimentboom@airxperimentboom4 жыл бұрын
  • Very nice video. After some moves how can we get the colors of the faces of a given cubie? Or at least it’s original position? Thanks

    @jmp1906@jmp19063 жыл бұрын
  • After I watched the first video I thought it will be nice to apply the transformation matrix that I learned during my study, sadly I never did it

    @taba1950@taba19505 жыл бұрын
    • Same

      @JackFlashTech@JackFlashTech3 жыл бұрын
  • You are such a fun interesting person, I would love to be friends with you lol. Also I am taking a intro to processing course and my instructor is using your purple rain and 3D terrain generator coding challenges as examples lol.

    @toasty7408@toasty74085 жыл бұрын
  • Good job thanks !!! What did not make him move like the real! Cube and colors?

    @chachouamohamed8557@chachouamohamed85574 жыл бұрын
  • an easy way to give the correct number of faces: for each cubie the number of faces is abs(x) + abs(y) + abs(z)

    @exnerhimself@exnerhimself4 жыл бұрын
  • You’re a genius..!!! Goodness!!

    @raymartgorosin7932@raymartgorosin79324 жыл бұрын
  • Every capital letter shares 7 bits with it's opposite case counterpart. If you can grab the binary ASCII data directly then FlipCase(char) should return char XOR 0x00100000

    @ajreukgjdi94@ajreukgjdi9411 ай бұрын
  • Here's a suggestion. There are actually infinitely many possible quads for any given normal, but we want those that "look right" for the problem at hand. We can think in terms of a spherical coordinate system to help us here. function DrawCubieFace( PVector n) { // Let's compute a few vectors using the cross product function for PVectors. // assuming that PVector n stores the normal vector. PVector axis = new PVector( 0, 0, 1); // unit vector along z-axis, also the spherical coordinates polar axis PVector lat = n.cross(axis).normalize(); // we compute a unit vector that is tangent to a "fixed latitude" circle, and perpendicular to n PVector lon = n.cross(lat).normalize(); // ...and a unit vector that is tangent to a "fixed longitude" circle. // The corners of our quad can be found by using the lat and lon PVectors // TODO: translate the result let s = 1; // length of the sides fill(255); // TODO: pick the right color here beginShape(); // Start from the center. PVector v = new PVector(0, 0, 0); // First corner v.add(PVector.mult( lat, s*0.5)).add(PVector.mult( lon, s*0.5)); vertex( v.x, v.y, v.z); // Second corner v.add(PVector.mult( lat, -s)); vertex( v.x, v.y, v.z); // Third corner v.add(PVector.mult( lon -s)); vertex( v.x, v.y, v.z); // Last corner v.add(lat); vertex( v.x, v.y, v.z); endShape(); } Disclaimer: I wasn't able to test this one. Debugging might be required.

    @xnick_uy@xnick_uy5 жыл бұрын
    • Oh, cross product! Not sure why i forgot about that!

      @TheCodingTrain@TheCodingTrain5 жыл бұрын
  • 50:46 //Bitwise XOR int changecase = 32: //or char changecase = ' '; // yes its actually space xD String nextMove = Character.toString(sequence.charAt(i)^changecase); //other way saying flip BIT 6(decimal 32 binary 00100000 char SPACE) thats uppercase/lowercase in ASCII table a->A 01100001^00100000=01000001 A->a 01000001^00100000=01100001

    @JarppaGuru@JarppaGuru2 жыл бұрын
  • i fucking love you man, you'r the best, every time i see a notification from your channel i became happy, thank you so much !!!!!!!!

    @oussamamahrouch@oussamamahrouch5 жыл бұрын
  • RIP Notre-Dame. :( Nice video, a good way to relax ^^

    @catapillie@catapillie5 жыл бұрын
    • rip...

      @d0nnyr0n@d0nnyr0n5 жыл бұрын
    • RIP

      @spaghettiking653@spaghettiking6535 жыл бұрын
  • part 3 is not transformed yet?

    @leguminosa9@leguminosa94 жыл бұрын
  • I feel like using a shape for each cubie like you had initially would've made it much simpler, rather than having the cubie made of individual faces, no?

    @lengors1674@lengors16742 жыл бұрын
  • Hey nice video! Why next don't you try to code a tetris game? I've already done one in python and it's not so complicated. To know all of the rules, you can search the tetris guidelines

    @jeeaile5835@jeeaile58355 жыл бұрын
  • Why do you use "(abs(normal.z) > 0)" and not just "(normal.z != 0)"? :)

    @YellowBunny@YellowBunny5 жыл бұрын
  • i get null pointer exception in cube[i].show(); why is this???

    @obadaalzidi6452@obadaalzidi64524 жыл бұрын
  • can you make it playable with mouse? id like to be able to use it.

    @geeknrd962@geeknrd9623 жыл бұрын
  • which program language you are using i like it and i want try it too

    @salehismail1896@salehismail18963 жыл бұрын
  • Are you planning to use neural networks or just hardcode some rules to solve the rubics cube?

    @SondreSrbye@SondreSrbye5 жыл бұрын
    • Still trying to figure out what will work but I would like the system to learn rather than use a specific hard-coded algorithm.

      @TheCodingTrain@TheCodingTrain5 жыл бұрын
  • You should do Tetris!

    @kfossa344@kfossa3445 жыл бұрын
  • Oh man some of the coding challenges are too hard to follow while others are just complex enough that I can solve them. I wish I could easily go over "beginner-friendly" ones as a playlist or something

    @abdur1996@abdur19965 жыл бұрын
    • This is a great idea!

      @TheCodingTrain@TheCodingTrain5 жыл бұрын
  • Us Java people pronounce char as it's spelled, not like 'car'

    @gosnooky@gosnooky4 жыл бұрын
    • but "character" is not pronounced as it's spelled

      @davutsauze8319@davutsauze83194 жыл бұрын
    • @@davutsauze8319 Then under that rule, "char" should be pronounced, "care." Fred

      @ffggddss@ffggddss4 жыл бұрын
    • Isosceles Kramer but „car move“ sounds funny😂

      @bastibob660@bastibob6604 жыл бұрын
  • Make it so you can drag the faces using your mouse, If it isnt to advanced :)

    @electricengine8407@electricengine84075 жыл бұрын
  • Missed opportunity lol. Could have been, Cubie qb = cube[e] ;)

    @paulbeck264@paulbeck2642 жыл бұрын
  • Try making classic Tetris in p5.js

    @vanshtanwani8049@vanshtanwani80495 жыл бұрын
    • I want to see that too!

      @ruler255@ruler2555 жыл бұрын
  • I Love the fact, that He named the Class cubie

    @maltee69@maltee693 жыл бұрын
  • how to make PMatix in Javascript (p5.js)??

    @JeffAporta@JeffAporta3 жыл бұрын
  • duRUDFuBLL - the title of my new metal album.

    @arturkarlov3000@arturkarlov30005 жыл бұрын
    • Why not LrLrdFbDru

      @VY_Canis_Majoris@VY_Canis_Majoris5 жыл бұрын
  • At 33:33, you saw me already nodding in agreement, didn't you?

    @zinsy23@zinsy235 жыл бұрын
  • you probably get it a lot but I would LOVE to see you make tetris

    @bensmart2829@bensmart28293 жыл бұрын
  • I don't think you got all the CW and CCW turning correct. If you to 39:00, you are turning opposite faces in the same direction which means that one is CW and the other is CCW. And it looks like you carried this minor bug through to the refactored switch code. Shouldn't be too hard to fix though. Just need to flip the direction on half the turns.

    @landonkryger@landonkryger5 жыл бұрын
    • 1:32 he explains that and why he doesn't care about cube notation here but rather in mathematical notation. He can switch to cube notation once the other implementation is done.

      @keineangabe8993@keineangabe89935 жыл бұрын
  • Is there a Part 3? EDIT: Found it.

    @bmj14772@bmj14772 Жыл бұрын
  • What program do you use to program?

    @daviamsilva@daviamsilva5 жыл бұрын
    • Processing

      @y_kazz3263@y_kazz32635 жыл бұрын
    • This video uses Processing (which is built on top of the Java programming language). For more info, visit processing.org and also this video might help kzhead.info/sun/dNGlcc2DqpuvY6c/bejne.html.

      @TheCodingTrain@TheCodingTrain5 жыл бұрын
    • lol, I thought it C, but when string come out i confused haha

      @jackshih6084@jackshih60842 жыл бұрын
  • so good

    @JohnPaulBuce@JohnPaulBuce Жыл бұрын
  • Nice

    @SpeckyYT@SpeckyYT5 жыл бұрын
  • i need a code for algoritem in pc for arduino then i would make it phisycal

    @allimahic4457@allimahic44574 жыл бұрын
  • is there no "tracking" in the library maybe someone should write it

    @gramps717@gramps7172 жыл бұрын
  • was on the stream

    @sweetberries4611@sweetberries46115 жыл бұрын
  • Wow

    @noclowns5356@noclowns53565 жыл бұрын
  • Solving a Rubik's cube with a standard genetic algorithm seems pretty hopeless. I tried several variations but it just cant solve any scramble that needs more than 6 rotations. A few observations: It was proven some years ago that every scramble of a 3X3X3 cube can be solved with maximum 26 quarter turn rotations. A 'DNA' with a fixed number of rotations (e.g. 26) does not work. For example: if the DNA length is 15 then the cube could be solved after 10 rotations and the next 5 just scramble it again. I calculated the fitness of each individual after each rotation and used the part of the DNA that resulted in the highest fitness. But Crossover of this best DNA or of the entire DNA does not seem to work very well here. A complete random DNA in each generation actually got better results in my tests. Anyone got any ideas what could work better here?

    @josgielen8524@josgielen85245 жыл бұрын
    • To make the problem simpler I would not allow the algorithm to do any move (at least not before you have working proof of concept), but rather make it pick from four options: - Rotate 3 corners - Rotate 3 edges - Flip 2 corners - Flip 2 edges There are easy algorithms to do these basic moves. You also need to pick the side you do this algorithm on (1 of 6) and the side of the cube you keep as the top when you do this algorithm (1 of 4). This is quite similar to how most blindfolded cubers solve their cubes. As a fitness function I would take whether the cubie is oriented correctly and how many spots it is from where it needs to be. I'm not very familiar with genetic algorithms, but the 'DNA' would need to store the ability to do multiple moves before a re-evaluation of the fitness of the cube (unless you use setup moves) because some configurations require to move a cubie to the other side of the cube. All four suggested moves are completely independent, so the 'DNA' can does not need to do everything right before learning something.

      @ErikWouters@ErikWouters5 жыл бұрын
    • Thanks for this thread! I haven't tried yet but this is super useful info.

      @TheCodingTrain@TheCodingTrain5 жыл бұрын
    • DNA of cube matches + cube moves would improve a GA . So you have a string of partial matches of the cube and a string of rotations. mutate the rotations list only. Also do it as a set of goals such as bottom then middle then top of cube.

      @georgechristoforou991@georgechristoforou9914 жыл бұрын
    • ​@@TheCodingTrain If you're going this deep, you may want to check out David Singmaster's booklet, _Notes on Rubik's Magic Cube,_ 1981. Singmaster was a lecturer in mathematical sciences & computing at the Polytechnic of the South Bank in London (now the London South Bank University). During the time Singmaster was accumulating these Notes, his office-mate, Morwen B. Thistlethwaite (no kidding!), was using his computer to search for "processes" (sequences of cube moves) that would efficiently solve the cube; and ones that would solve certain configurations of the cube. None of MBT's computer algorithms were detailed, or even described in the Notes, but it's possible that a net search might turn up something useful. Some of the processes he discovered this way, are given in the Notes. One of the most interesting features of the MBTC (MBT's Computer) solution processes was that, contrary to the vast majority of (human) cubers' solution methods, his would not appear to be making any progress until the last few moves, when everything would suddenly fall into place. It seems likely that the "ideal" solution would work this way. Main point is, this is a longtime, well-trodden problem, and there are bound to be lots of interesting ideas out there for how to do this (which, BTW, I'm not at all plugged into). OTOH, if your purpose is to work out your own method, independent of prior work in this area, I completely understand and support that. It'll be good to see what you might come up with. Fred

      @ffggddss@ffggddss4 жыл бұрын
    • @@ErikWouters Those four processes are, of course, essential to solving the "top layer," once the other two layers are done (which is relatively easier). I trust that by "rotate," you mean cyclically permute, without changing the "orientation" (the facelet within the top layer) of the pieces. Also note that, while edges are said to "flip" (between 2 possible states), corners "twist" (having 3 possible states). When a pair of corners twist, they must do so in opposite directions. A fifth possible top layer process is a tri-twist, where 3 corner pieces all twist in the same direction. These two moves have been nicknamed, "meson" and "baryon" moves, respectively; with a single corner twist (impossible in isolation) being analogous to a "quark." Fred

      @ffggddss@ffggddss4 жыл бұрын
  • You can do also a solver

    @nassiandrea5802@nassiandrea58024 жыл бұрын
  • You're a freaking genius

    @vympel2732@vympel27325 жыл бұрын
  • Wonderful, Wonderful, Wonderful.

    @hasnainfareed8555@hasnainfareed85553 жыл бұрын
  • Dan, are you going to finish this challenge?

    @vladig2835@vladig28352 жыл бұрын
    • Pt 3: kzhead.info/sun/a7lrl9eahZdniKc/bejne.html

      @krccmsitp2884@krccmsitp2884 Жыл бұрын
  • Agghhh I got really bugged when U used all those else if statements instead of a switch.

    @rhysperry111@rhysperry1115 жыл бұрын
    • Technically does the same thing. I don't see that much of a problem in doing so (then again i don't know too much about time/space complexity maybe there is a downfall there between both methods)

      @harjitsingh7308@harjitsingh73085 жыл бұрын
    • Harjit Singh the main reason a switch statement is better is because it is easier to read. I’m not sure about this but it is probably also better optimised.

      @rhysperry111@rhysperry1115 жыл бұрын
    • @@rhysperry111 Actually I don't agree on the readability statement. Switch statements are usually not really that easier to read. They are quite nice for two reasons: You can actually have a complex calculation inside the switch() which will be calculated once and then compared. Of course this can also be achieved with a local variable so not really a strong argument. The second reason which is the most important one is that depending on the language and implementation you usually get a performance gain if you have many switch cases. I'm not really using Java (or processing) but I know exactly how C# implements switch cases. If the actual case values can be arranged in a certain order and don't have too large gaps, the compiler simply makes a jump table and uses the switch argument as index. If there's just one huge gap it might split it into two jump tables. If all values are a fix amount apart it might use some preprocessing math (like dividing the value by 4). If nothing helps and the number of cases is rather small, it just creates an if else chain. If the case count is high enough it actually uses a hashtable lookup to convert the values into an integer and use that in the jump table. C# doesn't allow fall through except a case is empty. So it's essentially just two case values merged into one. As far as i know Java does allow fall through just like C / C++. However this doesn't really help the readability and might enforce some strange ordering of the cases. Also it's a mess regarding scope since the whole switch body is one scope so you easily get issues with local variables. Adding curly braces to each case does not only make it even longer, but also terrible to format in a nice way. For "relatively" small if else chains they are usually shorter and easier to read. For example having only one statement in each if body allows you to write one elseif in one line. The different conditions nicely align and the actual executed statements align nicely. For example have a look at the input processing for my Rubik's Cube in the Update method. This btw is a complete Rubik's cube done in 300 lines in Unity3d: www.dropbox.com/s/gyif5k3y0w4n68d/RubikCube.cs?dl=0 I've done this somewhere in march 2018 for fun^^. Usually I love to create things procedurally but in this case i just used 27 of Unity's default cubes. Just make sure you use a shader that uses vertex colors.

      @Bunny99s@Bunny99s4 жыл бұрын
  • What is the languege that you are programming?

    @elirannissani914@elirannissani9144 жыл бұрын
    • Javascript

      @keppycs@keppycs4 жыл бұрын
    • Close, it's Java not javascript

      @andrewbalzer6263@andrewbalzer62634 жыл бұрын
    • @@andrewbalzer6263Why'd it be Java? Pretty sure it's JavaScript like every other video of his

      @keppycs@keppycs4 жыл бұрын
    • @@keppycs two reasons: 1. The syntax is Java not javascript. Notice the "void" in the functions and strong typing used for variables (int/string not const/var). 2. He specifically said that Processing uses Java at 1:49 of the pt 1 video and in a reply to one of the other comments on this video.

      @andrewbalzer6263@andrewbalzer62634 жыл бұрын
    • @@keppycs also, he's using javascript in his other videos because they're usually web dev related and javascript is most oft used for web dev. Java is less used for web dev and more used for standalone applications like this. (those aren't hard rules but are decent rules of thumb)

      @andrewbalzer6263@andrewbalzer62634 жыл бұрын
  • yeah proud pinoy HAHAHHA

    @francislydz4234@francislydz42343 жыл бұрын
  • 2nd image of blackhole XDDDD

    @k1rgizia@k1rgizia5 жыл бұрын
  • Should started with random colors :)

    @mr-backend2710@mr-backend27103 жыл бұрын
  • 0x3f800000th post!

    @TheRainHarvester@TheRainHarvester5 жыл бұрын
    • Ryan Paul in my haste, I missed the 3! I fixed it. Thanks!

      @TheRainHarvester@TheRainHarvester5 жыл бұрын
    • @@TheRainHarvester 17045651456? I still don;t get it.

      @d0nnyr0n@d0nnyr0n5 жыл бұрын
    • 17104371712th post?

      @Tokyo_Pessi@Tokyo_Pessi5 жыл бұрын
  • Im not a programmer.... and I understand none.... but Im interested because of the fact that Im a cuber

    @sloppyvic6971@sloppyvic69713 жыл бұрын
  • This is 100 times more complicated than it should be. 444000555 444000555 444000555 111 111 111 222 222 222 333 333 333 This is your basic cube represented as 6 faces with 9 squares in each face.

    @georgechristoforou991@georgechristoforou9914 жыл бұрын
  • Add neural net

    @mr.norris3840@mr.norris38405 жыл бұрын
  • you could probably learn to solve a rubiks cube and make an algorithm for this. im thinking of making a robot that does this.

    @geeknrd962@geeknrd9623 жыл бұрын
  • 24:12 why your code did not work mine did lol If statements lol lol

    @JarppaGuru@JarppaGuru2 жыл бұрын
  • 9:21 everything should be correct unless skipped some lines errors that not mean anything. why cant say what is error lol. do i need import PMAtrix3D or class? install something?use prosessing 3? *java.lang.RuntimeException: java.lang.ClassNotFoundException: Rubik2 at processing.core.PApplet.runSketch(PApplet.java:10275) at processing.core.PApplet.main(PApplet.java:10083) Caused by: java.lang.ClassNotFoundException: Rubik2 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at processing.core.PApplet.runSketch(PApplet.java:10268) ... 1 more OMG like 2 hour pulling hair. C drive FULL!. error not read anything bout it pff

    @JarppaGuru@JarppaGuru2 жыл бұрын
  • The stickers on the cube should have round corners. Just saying.

    @WildAnimalChannel@WildAnimalChannel5 жыл бұрын
    • so what's the actual value in this? is it just the fact of a standard or does it serve any purpose in cube solving?

      @Kitulous@Kitulous5 жыл бұрын
    • @@Kitulous with a physical cube the rounded corners allow for faster solving through corner cutting, in a program it doesn't matter at all.

      @MarsUltorPlays@MarsUltorPlays5 жыл бұрын
    • @@Kitulous On the stickers no, the curvature doesn't matter. But on the pieces curvature stops the cube from catching and helps corner-cutting, which is the layers aligning themselves as you turn.

      @kesleta7697@kesleta76974 жыл бұрын
  • 42:32 you have not move index 0 mean center

    @JarppaGuru@JarppaGuru2 жыл бұрын
  • 9:11 I am having a NullPointerException here. What do I do? P.S.- Look at the timestamp it's 911 lol

    @codeforest9027@codeforest90275 жыл бұрын
    • Oops, it was some other error. I accidentally dialed 911 :P

      @codeforest9027@codeforest90275 жыл бұрын
    • @@codeforest9027 same, what did you do?

      @0Arman0@0Arman05 жыл бұрын
    • @@0Arman0 There was a SLIGHT change a few lines above it. If you look at it VERY closely, you can find it. I can't exactly remember, something with the numbers

      @codeforest9027@codeforest90275 жыл бұрын
    • @@codeforest9027 thanks it turned out to be the equality comparison I didn't add the = sign

      @0Arman0@0Arman05 жыл бұрын
  • Nice pic dear

    @RIQUOLF@RIQUOLF5 жыл бұрын
    • Raqib Imam Yes, nice pic... idiot

      @Endeavr_@Endeavr_5 жыл бұрын
    • @@Endeavr_ ???

      @d0nnyr0n@d0nnyr0n5 жыл бұрын
  • Huh

    @aidanlawrence554@aidanlawrence5545 жыл бұрын
  • No views ?

    @TVPlush@TVPlush5 жыл бұрын
  • Cnc/gcode visualiser. X y z

    @galihtanu@galihtanu3 жыл бұрын
  • The guiltless minute utrastructurally ruin because italy alarmingly drop sans a thick whiskey. spotted, three test

    @voguemist9171@voguemist91713 жыл бұрын
KZhead