Coding Challenge

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024

ความคิดเห็น • 159

  • @d0nnyr0n
    @d0nnyr0n 5 ปีที่แล้ว +38

    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!

  • @zl25drexel
    @zl25drexel 5 ปีที่แล้ว +99

    offset = (3 - 1) * len * 1/2 ... that's a long way of expressing len, LOL

    • @albinwarme6109
      @albinwarme6109 4 ปีที่แล้ว +5

      Well we all make misstakes don't we. A prime example

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +9

      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
      @ffggddss 4 ปีที่แล้ว +4

      @@albinwarme6109 *missteaks
      And no; some of us are perphict...
      Fred

  • @germancubesolveryolo4524
    @germancubesolveryolo4524 5 ปีที่แล้ว +166

    Idea for a coding challenge: A Sudoku solver. Its probably not that hard, but I still want to see your approach. Greetings from Germany!

    • @rstewa35
      @rstewa35 5 ปีที่แล้ว +6

      GermanCubeSolver YOLO good idea. Using recursion it's a fun one

    • @dankwarmouse6248
      @dankwarmouse6248 5 ปีที่แล้ว +7

      Causally droppin those NP-Complete bombs

    • @oofusmcdoofus
      @oofusmcdoofus 5 ปีที่แล้ว +4

      Sodoku isnt NP-Complete

    • @kevnar
      @kevnar 5 ปีที่แล้ว +6

      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.

    • @Sirvierl0ffel
      @Sirvierl0ffel 5 ปีที่แล้ว +2

      DEUTSCHLAND!!!!!!!

  • @RaysOfPivot
    @RaysOfPivot 5 ปีที่แล้ว +65

    I usually have absolutely no idea what's going on, but here I am sat watching for an hour. Cause he makes it interesting!

    • @jackmead7292
      @jackmead7292 4 ปีที่แล้ว +1

      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).

    • @puppergump4117
      @puppergump4117 2 ปีที่แล้ว +1

      @@jackmead7292 Doesn't he livestream it

  • @Kirkster
    @Kirkster 5 ปีที่แล้ว +6

    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 :)

  • @richlai3378
    @richlai3378 5 ปีที่แล้ว +13

    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 :)

    • @kesleta7697
      @kesleta7697 5 ปีที่แล้ว +3

      The other middles are E for equator and S for standing. But there rarely used.

    • @kesleta7697
      @kesleta7697 5 ปีที่แล้ว +2

      Although it's technically the same as a R and an L' or vice versa

    • @richlai3378
      @richlai3378 5 ปีที่แล้ว +1

      @@kesleta7697 yes!! :)

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +1

      These are also collectively called, "slice" moves.
      Fred

    • @jansalomon5749
      @jansalomon5749 4 ปีที่แล้ว +4

      His comment ¨it's not really a thing¨ shocked me. I'm using the Roux method :)

  • @Nervosa80
    @Nervosa80 3 ปีที่แล้ว +1

    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. 🤜🤛

  • @Erik31415
    @Erik31415 5 ปีที่แล้ว +6

    This code is so much cleaner than what I saw in the live stream. Very nice!

  • @ninjahyper5079
    @ninjahyper5079 3 ปีที่แล้ว +2

    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
      @ninjahyper5079 3 ปีที่แล้ว +2

      I have done it and it works amazingly
      I can share the code also

    • @ninjahyper5079
      @ninjahyper5079 3 ปีที่แล้ว +2

      just i couldn't do it in the animation thing that you had done in the 3rd video

  • @garm0nb0z1a
    @garm0nb0z1a 5 ปีที่แล้ว +6

    The best one yet. Can't wait to see the animation.

  • @Dhakshith1189
    @Dhakshith1189 5 ปีที่แล้ว +7

    This was the day I was waiting for where cubing and coding combine;
    Thanks!

    • @sinpi314
      @sinpi314 3 ปีที่แล้ว

      Same!

  • @djsyntic
    @djsyntic 2 ปีที่แล้ว +2

    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

  • @rohan1002
    @rohan1002 4 ปีที่แล้ว +16

    "Guess what i can turn it...uh..wait" - Programming in one line.

    • @le_plankton
      @le_plankton 4 ปีที่แล้ว

      Rohan Gupta yes

    • @noahnolte7288
      @noahnolte7288 4 ปีที่แล้ว

      Here's programming in one line:
      SyntaxError: "Bro why are up its 3 am
      Error: No closing quotes.

  • @fuzzy-02
    @fuzzy-02 4 ปีที่แล้ว +1

    I learned a lot from you
    Like how you do small steps and test them
    And how you keep your mood high

  • @xheptc9612
    @xheptc9612 3 ปีที่แล้ว +1

    Started watching your videos, and they are amazing, I learned some things about coding, amazing challenges you do!

  • @ajreukgjdi94
    @ajreukgjdi94 ปีที่แล้ว +1

    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

  • @luismiguelgallegogomez8000
    @luismiguelgallegogomez8000 5 ปีที่แล้ว +1

    5:10 Changing the i, j, k to x, y, z... That was awesome :)

  • @ttrouble1711
    @ttrouble1711 5 ปีที่แล้ว +17

    I love you!! You inspire me everyday and i wish i could have your energy and positivity

  • @geoffwagner4935
    @geoffwagner4935 8 หลายเดือนก่อน

    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

  • @fotiskapotos
    @fotiskapotos 5 ปีที่แล้ว +6

    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

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +3

      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

  • @xnick_uy
    @xnick_uy 5 ปีที่แล้ว +1

    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.

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +1

      Oh, cross product! Not sure why i forgot about that!

  • @iradnuriel9087
    @iradnuriel9087 5 ปีที่แล้ว +1

    The best one hour video I have ever watched!!!!

  • @toadfrommariokart64
    @toadfrommariokart64 4 ปีที่แล้ว +1

    an easy way to give the correct number of faces:
    for each cubie the number of faces is abs(x) + abs(y) + abs(z)

  • @alksri
    @alksri 4 ปีที่แล้ว

    this video helped so much in my school project. thank you so much!!

  • @vanshtanwani8049
    @vanshtanwani8049 5 ปีที่แล้ว +26

    Try making classic Tetris in p5.js

    • @ruler255
      @ruler255 5 ปีที่แล้ว +1

      I want to see that too!

  • @lengors1674
    @lengors1674 2 ปีที่แล้ว +1

    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?

  • @gosnooky
    @gosnooky 5 ปีที่แล้ว +6

    Us Java people pronounce char as it's spelled, not like 'car'

    • @davutsauze8319
      @davutsauze8319 4 ปีที่แล้ว

      but "character" is not pronounced as it's spelled

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +1

      @@davutsauze8319 Then under that rule, "char" should be pronounced, "care."
      Fred

    • @bastibob660
      @bastibob660 4 ปีที่แล้ว

      Isosceles Kramer but „car move“ sounds funny😂

  • @RicoGalassi
    @RicoGalassi 5 ปีที่แล้ว +2

    so much for getting my course work done tonight..haha

  • @JarppaGuru
    @JarppaGuru 2 ปีที่แล้ว +1

    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

  • @taba1950
    @taba1950 5 ปีที่แล้ว +3

    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

  • @paulbeck264
    @paulbeck264 2 ปีที่แล้ว +1

    Missed opportunity lol. Could have been, Cubie qb = cube[e] ;)

  • @airxperimentboom
    @airxperimentboom 5 ปีที่แล้ว +2

    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!

  • @landonkryger
    @landonkryger 5 ปีที่แล้ว +3

    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.

    • @keineangabe8993
      @keineangabe8993 5 ปีที่แล้ว

      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.

  • @jeeaile5835
    @jeeaile5835 5 ปีที่แล้ว +1

    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

  • @toasty7408
    @toasty7408 5 ปีที่แล้ว +4

    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.

  • @SondreSrbye
    @SondreSrbye 5 ปีที่แล้ว +1

    Are you planning to use neural networks or just hardcode some rules to solve the rubics cube?

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +2

      Still trying to figure out what will work but I would like the system to learn rather than use a specific hard-coded algorithm.

  • @catapillie
    @catapillie 5 ปีที่แล้ว +7

    RIP
    Notre-Dame. :(
    Nice video, a good way to relax ^^

  • @arturkarlov3000
    @arturkarlov3000 5 ปีที่แล้ว +4

    duRUDFuBLL - the title of my new metal album.

  • @abdur1996
    @abdur1996 5 ปีที่แล้ว +1

    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

  • @jmp1906
    @jmp1906 4 ปีที่แล้ว

    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

  • @electricengine8407
    @electricengine8407 5 ปีที่แล้ว +1

    Make it so you can drag the faces using your mouse, If it isnt to advanced :)

  • @raymartgorosin7932
    @raymartgorosin7932 5 ปีที่แล้ว +1

    You’re a genius..!!! Goodness!!

  • @gramps717
    @gramps717 2 ปีที่แล้ว +1

    is there no "tracking" in the library maybe someone should write it

  • @roshan_singh5709
    @roshan_singh5709 5 ปีที่แล้ว

    Hats off 2 u..I just loved the codes u wrote..

  • @bmj14772
    @bmj14772 2 ปีที่แล้ว +1

    Is there a Part 3? EDIT: Found it.

  • @YellowBunny
    @YellowBunny 5 ปีที่แล้ว +1

    Why do you use "(abs(normal.z) > 0)" and not just "(normal.z != 0)"? :)

  • @chachouamohamed8557
    @chachouamohamed8557 4 ปีที่แล้ว

    Good job thanks !!! What did not make him move like the real! Cube and colors?

  • @JohnPaulBuce
    @JohnPaulBuce 2 ปีที่แล้ว +1

    so good

  • @maltee69
    @maltee69 4 ปีที่แล้ว

    I Love the fact, that He named the Class cubie

  • @kfossa344
    @kfossa344 5 ปีที่แล้ว +1

    You should do Tetris!

  • @bensmart2829
    @bensmart2829 3 ปีที่แล้ว

    you probably get it a lot but I would LOVE to see you make tetris

  • @vympel2732
    @vympel2732 5 ปีที่แล้ว +2

    You're a freaking genius

  • @salehismail1896
    @salehismail1896 4 ปีที่แล้ว

    which program language you are using i like it and i want try it too

  • @hasnainfareed8555
    @hasnainfareed8555 3 ปีที่แล้ว

    Wonderful, Wonderful, Wonderful.

  • @josgielen8524
    @josgielen8524 5 ปีที่แล้ว +1

    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?

    • @Erik31415
      @Erik31415 5 ปีที่แล้ว

      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.

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +3

      Thanks for this thread! I haven't tried yet but this is super useful info.

    • @georgechristoforou991
      @georgechristoforou991 5 ปีที่แล้ว

      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.

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว

      ​@@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
      @ffggddss 4 ปีที่แล้ว

      @@Erik31415 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

  • @JeffAporta
    @JeffAporta 3 ปีที่แล้ว

    how to make PMatix in Javascript (p5.js)??

  • @TheRainHarvester
    @TheRainHarvester 5 ปีที่แล้ว +9

    0x3f800000th post!

    • @TheRainHarvester
      @TheRainHarvester 5 ปีที่แล้ว

      Ryan Paul in my haste, I missed the 3! I fixed it. Thanks!

    • @d0nnyr0n
      @d0nnyr0n 5 ปีที่แล้ว +1

      @@TheRainHarvester 17045651456? I still don;t get it.

    • @Tokyo_Pessi
      @Tokyo_Pessi 5 ปีที่แล้ว

      17104371712th post?

  • @oussamamahrouch
    @oussamamahrouch 5 ปีที่แล้ว

    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 !!!!!!!!

  • @zinsy23
    @zinsy23 5 ปีที่แล้ว +2

    At 33:33, you saw me already nodding in agreement, didn't you?

  • @sloppyvic6971
    @sloppyvic6971 4 ปีที่แล้ว +1

    Im not a programmer.... and I understand none.... but Im interested because of the fact that Im a cuber

  • @elirannissani914
    @elirannissani914 5 ปีที่แล้ว +2

    What is the languege that you are programming?

    • @keppycs
      @keppycs 5 ปีที่แล้ว

      Javascript

    • @andrewbalzer6263
      @andrewbalzer6263 5 ปีที่แล้ว

      Close, it's Java not javascript

    • @keppycs
      @keppycs 5 ปีที่แล้ว

      @@andrewbalzer6263Why'd it be Java? Pretty sure it's JavaScript like every other video of his

    • @andrewbalzer6263
      @andrewbalzer6263 5 ปีที่แล้ว +1

      @@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
      @andrewbalzer6263 5 ปีที่แล้ว

      @@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)

  • @geeknrd962
    @geeknrd962 3 ปีที่แล้ว

    can you make it playable with mouse? id like to be able to use it.

  • @rhysperry111
    @rhysperry111 5 ปีที่แล้ว +2

    Agghhh I got really bugged when U used all those else if statements instead of a switch.

    • @harjitsingh7308
      @harjitsingh7308 5 ปีที่แล้ว

      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)

    • @rhysperry111
      @rhysperry111 5 ปีที่แล้ว

      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.

    • @Bunny99s
      @Bunny99s 5 ปีที่แล้ว +1

      @@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.

  • @sweetberries4611
    @sweetberries4611 5 ปีที่แล้ว +3

    was on the stream

  • @vladig2835
    @vladig2835 2 ปีที่แล้ว

    Dan, are you going to finish this challenge?

    • @krccmsitp2884
      @krccmsitp2884 ปีที่แล้ว

      Pt 3: th-cam.com/video/8U2gsbNe1Uo/w-d-xo.html

  • @francislydz4234
    @francislydz4234 3 ปีที่แล้ว

    yeah proud pinoy HAHAHHA

  • @georgechristoforou991
    @georgechristoforou991 5 ปีที่แล้ว

    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.

  • @leguminosa9
    @leguminosa9 5 ปีที่แล้ว

    part 3 is not transformed yet?

  • @mr.norris3840
    @mr.norris3840 5 ปีที่แล้ว +1

    Add neural net

  • @JarppaGuru
    @JarppaGuru 2 ปีที่แล้ว

    42:32 you have not move index 0 mean center

  • @geeknrd962
    @geeknrd962 3 ปีที่แล้ว

    you could probably learn to solve a rubiks cube and make an algorithm for this. im thinking of making a robot that does this.

  • @allimahic4457
    @allimahic4457 4 ปีที่แล้ว

    i need a code for algoritem in pc for arduino then i would make it phisycal

  • @k1rgizia
    @k1rgizia 5 ปีที่แล้ว

    2nd image of blackhole XDDDD

  • @WildAnimalChannel
    @WildAnimalChannel 5 ปีที่แล้ว

    The stickers on the cube should have round corners. Just saying.

    • @Kitulous
      @Kitulous 5 ปีที่แล้ว +1

      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?

    • @MarsUltorPlays
      @MarsUltorPlays 5 ปีที่แล้ว

      @@Kitulous with a physical cube the rounded corners allow for faster solving through corner cutting, in a program it doesn't matter at all.

    • @kesleta7697
      @kesleta7697 5 ปีที่แล้ว +1

      @@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.

  • @JarppaGuru
    @JarppaGuru 2 ปีที่แล้ว

    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

  • @nassiandrea5802
    @nassiandrea5802 5 ปีที่แล้ว

    You can do also a solver

  • @daviamsilva
    @daviamsilva 5 ปีที่แล้ว

    What program do you use to program?

    • @y_kazz3263
      @y_kazz3263 5 ปีที่แล้ว +1

      Processing

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +2

      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 th-cam.com/video/AmlAiKsiy0o/w-d-xo.html.

    • @jackshih6084
      @jackshih6084 3 ปีที่แล้ว

      lol, I thought it C, but when string come out i confused haha

  • @JarppaGuru
    @JarppaGuru 2 ปีที่แล้ว

    24:12 why your code did not work mine did lol If statements lol lol

  • @noclowns5356
    @noclowns5356 5 ปีที่แล้ว

    Wow

  • @SpeckyYT
    @SpeckyYT 5 ปีที่แล้ว

    Nice

  • @codeforest9027
    @codeforest9027 5 ปีที่แล้ว +1

    9:11 I am having a NullPointerException here. What do I do?
    P.S.- Look at the timestamp it's 911 lol

    • @codeforest9027
      @codeforest9027 5 ปีที่แล้ว

      Oops, it was some other error. I accidentally dialed 911 :P

    • @0Arman0
      @0Arman0 5 ปีที่แล้ว

      @@codeforest9027 same, what did you do?

    • @codeforest9027
      @codeforest9027 5 ปีที่แล้ว +1

      @@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

    • @0Arman0
      @0Arman0 5 ปีที่แล้ว

      @@codeforest9027 thanks it turned out to be the equality comparison I didn't add the = sign

  • @aidanlawrence554
    @aidanlawrence554 5 ปีที่แล้ว +1

    Huh

  • @RIQUOLF
    @RIQUOLF 5 ปีที่แล้ว

    Nice pic dear

    • @Endeavr_
      @Endeavr_ 5 ปีที่แล้ว

      Raqib Imam Yes, nice pic... idiot

    • @d0nnyr0n
      @d0nnyr0n 5 ปีที่แล้ว

      @@Endeavr_ ???

  • @TVPlush
    @TVPlush 5 ปีที่แล้ว

    No views ?

  • @galihtanu
    @galihtanu 4 ปีที่แล้ว

    Cnc/gcode visualiser. X y z

  • @voguemist9171
    @voguemist9171 3 ปีที่แล้ว

    The guiltless minute utrastructurally ruin because italy alarmingly drop sans a thick whiskey. spotted, three test

  • @obadaalzidi6452
    @obadaalzidi6452 5 ปีที่แล้ว +1

    i get null pointer exception in cube[i].show();
    why is this???

  • @mr-backend2710
    @mr-backend2710 4 ปีที่แล้ว

    Should started with random colors :)