Code Mastermind Learns Multiplication

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024
  • I take another go at a simple doubler. Being able to multiply a number by 2 is one thing, being able to code it is another. But even that should be pretty easy. When we have to output the result of the multiplication by digits that have no idea of the planned result, their index, or anything at all but their neighbour, this coding puzzle takes a real turn.
    Watch me as I try to remedy last week's fiasco where I didn't even understand simple mathematical operations. This video is a must-watch for every beginner programmer or even advanced software engineer.
    🔔 Subscribe to the channel for more gaming adventures, coding challenges, and tech insights!
    🎬 Watch the full 7 Billion Humans series here: • 7 Billion Humans
    🎮 Other Puzzle Videos: • Shapez Puzzles
    🔥 Shorts: • Shorts
    #puzzlegame #codingchallenge

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

  • @realdragon
    @realdragon 4 หลายเดือนก่อน

    You don't need that one line
    mem 1 = cal (number to right) x 2
    And then have if statement if (mem 1 > 9)
    You could just remove mem 1 = cal (number to right) x 2 and instead have just if statement
    if (number to right > 4)
    Also "I cried a lot" is relatable

    • @KedrigernGaming
      @KedrigernGaming  4 หลายเดือนก่อน +1

      That’s something I only realized last week based on some comments. Nearly pulled all my hair out.

    • @tuxino
      @tuxino 4 หลายเดือนก่อน

      @@KedrigernGaming
      Except for that small detail, your current solution is basically exactly the same as what we discussed in the comments last week. Oh and you added the extra calculation to ensure that they stayed in sync - I'm pretty sure it would have been impossible to get a reasonably fast time without that, because the only way to avoid it is to wreck the parallelization.
      I think that what caused you trouble this time, was that you focused on optimizing the guy finishing last, which is usually a good ide to lower the time. But when the last guy is basically only busy waiting for the others, it is better to focus on the others and the adjust the waiting delays afterwards.

    • @KedrigernGaming
      @KedrigernGaming  4 หลายเดือนก่อน

      Awesome! I was really happy with that.
      I agree optimizing the last guy was pointless as it would only save less than a second after the last loop. I realized it too late and couldn't think of a way to optimize the others. But the idea I saw last week blew my mind. How have I not realized I could save a calculation using a simple if statement?

    • @tuxino
      @tuxino 4 หลายเดือนก่อน +1

      @@KedrigernGaming
      Yep, for the most part, getting rid of a calculation will speed things up. But in one of the other levels, using a calculation will make it faster. Problem is that the level requirements are lying to you.
      On that level, it tells you that the workers have to exit through the holes. That's not true - they just have to be gone, whichever way you manage that. And for the slowest worker, who is also furthest from the holes, it is faster to divide by zero than walk into the hole.

    • @KedrigernGaming
      @KedrigernGaming  4 หลายเดือนก่อน +1

      Oh wow!
      I even forgot dividing by zero is a thing. I always try to stay away from it which is generally a good idea.
      Shame the next episode is already in the works.