Daddy needs a new pair of RAM!

edit: the fps are way better in smaller terminal windows with lower character count but then it’s hard to make out the dice. D:

edit2: code here (expires in 2 weeks)

  • Pudutr0n@lemmy.worldOP
    link
    fedilink
    arrow-up
    9
    ·
    15 hours ago

    I can easily check for when motion stops, but checking for when any particular face is both parallel to the floor and at the same level can be computationally expensive, particularly in the dice with more sides. What you’re suggesting is likely a good idea, but I wouldn’t know how to get probabilities without doing what I just mentioned. I’m sure there’s an optimization i can do with this that I can’t think of rn.

    • hirihit640@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      15 hours ago

      maybe just “if velocity < 0.01, find which side is closest to the floor, and if its within 1mm of the floor, take the opposite side (the one facing up) as the answer”

      The only edge case I can think of is if it gets close to balancing on an edge, and then finally tips over to one side or the other. But in that case I don’t think the face closest to the floor would be within 1mm of the floor, so it should still work.

      • Pudutr0n@lemmy.worldOP
        link
        fedilink
        arrow-up
        6
        ·
        15 hours ago

        that’s how it’s implemented, mostly, but sometimes dice “stop” while they’re still tilted and standing on a corner (and then roll back down, possibly going back more than 1 face) so there’s also that.

        • hirihit640@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          3
          ·
          11 hours ago

          Ok well there’s probably a dozen different ways to tackle this issue but I’ll let you explore them since that’s part of the fun (and I’m lazy lol)