epidiah , (edited )
@epidiah@dice.camp avatar

I beat today's with ⚀ roll!

https://www.dig1000holes.com/digs/dle

I regret to inform you that I'm back on my bullshit.

...

SinbadEV ,
@SinbadEV@mastodon.social avatar

@epidiah I also beat today's with ⚀ roll!

Feel like there's a 7/10 chance everyone will.

bigdamnnerd ,
@bigdamnnerd@dice.camp avatar

@epidiah back on it, or still on it?

epidiah OP ,
@epidiah@dice.camp avatar

@bigdamnnerd Ha! Definitely still.

epidiah OP ,
@epidiah@dice.camp avatar

The good news is, I'm getting more practiced at this whole coding webpages deal.

The bad news is, the distance from inane idea to inane implementation grows ever shorter.

epidiah OP ,
@epidiah@dice.camp avatar

I made this using ClojureScript, same as I did back when I made . But, with Wastrle, I used the Reagent library, https://reagent-project.github.io/, which is a ClojureScript wrapper around React that I know believe is absolute sorcery.

I really enjoyed the way Reagent let me think about the design of Wastrle. However, I wanted to challenge myself with making something similar, though less intricate, using just ClojureScript.

This was half the impetus for .

The other half was kind of a pun.

epidiah OP ,
@epidiah@dice.camp avatar

is a daily guessing game.

The computer rolls a die and tells you the result. You're supposed the guess the type of die rolled. If you do, you will. If not, the computer rolls again and you get another shot.

At the moment, the possible dice include d4, d6, d8, d10, d12, d20, d30, d00, and dF.

I'm open to implementing more dice, but right now, I wanted to stick to dice I've had in my collection for at least 30 years. (less that really weird d24)

epidiah OP ,
@epidiah@dice.camp avatar

There were a lot of really fun things to implement in this one.

One challenge, was to make a pseudo-random number generator.

Obviously, I wanted random numbers, but not just any random numbers! I wanted to be able to ask your browser what day it was, feed that date into my random number generator, and get the same sequence of "random" numbers that everyone else was getting on that date.

epidiah OP ,
@epidiah@dice.camp avatar

This is a thing I've been playing with since my days of calculator programming: https://en.wikipedia.org/wiki/Linear_congruential_generator

There's no random number generator on a HP-12c, so if I wanted to a pocket dice-roller, I had to code up one of these formulas.

The basic idea is that you feed it a number and it spits out a number that you wouldn't expect, in a particular range, where it is somewhat uniformly distributed.

epidiah OP ,
@epidiah@dice.camp avatar

The process is simple.

Start with a seed number.

Multiply that number by A.

Add that result to C.

Then you divide your total by M and use the remainder. (It's a little more nuanced than that, but for our purposes, this works.)

The result is a number between 0 and M. If you choose a good A and C, this number will feel random.

If you divide this result by M, you get a number between 0 and 1 (not including the 1), which you can multiply by the die size and add 1 to get a "random" roll.

epidiah OP ,
@epidiah@dice.camp avatar

It's a neat trick that works well, if you pick decent enough values for A, C, and M. Fortunately, plenty of diligent people have already figured out decent enough values for you. Check out the Wikipedia article above for more details.

For my purposes, this is great. I just turn the current date into the initial seed number and off we go!

shannonmcmaster ,
@shannonmcmaster@dice.camp avatar

@epidiah

Nice. I feel like I remember learning that my x86 computers did this each time I turned it on to seed any need for "random" numbers during that period.

epidiah OP ,
@epidiah@dice.camp avatar

Another fun mathy bit was figuring out how to calculate your score.

I mean, the score is just the number of guesses it takes, but the score is displayed as a bunch of d6 faces where you total the pips.

So there's only one way to get a 1: ⚀

But there are four ways to get a 4: ⚃ or ⚂⚀ or ⚁⚁ or ⚀⚀⚀⚀

And that's if the order of the dice don't matter. It gets worse if they do.

As you might expect, this is one of those math situations that gets big, fast!

epidiah OP ,
@epidiah@dice.camp avatar

I got to solve this with recursion, which is always exciting to me.

The end result is a bit of a mess because eventually I realized that I never want it spitting out nine d6s or whatever. It would just be too much of a hassle making the "graphics" of the site adapt to that. So when the numbers get big, you start rolling a suspicious amount of 6s.

But it was fun thinking through this problem recursively!

tresi ,
@tresi@dice.camp avatar

@epidiah A calculator manual was the first time I found the world “pseudorandom”, and I remember being confused that I couldn't find the definition in our big dictionary. It was for a Blackjack game.

epidiah OP ,
@epidiah@dice.camp avatar

@tresi I spent so much time trying to figure out the significance of the number 997 because, perhaps by tradition, that was the number all the calculator programs I saw used for their multiplier. I was like, "Is there something magical about this number?"

I think it's just the highest 3-digit prime and that felt right to people.

ericmpaq ,
@ericmpaq@dice.camp avatar

@epidiah Is the d100 an actual die (the golfball one) or is it 2d10 used as percentile?

epidiah OP ,
@epidiah@dice.camp avatar

@ericmpaq I've never had one of the golf balls, which is kind of a shame now that I think about it.

In will accept d00, d100, and d% all as the same answer, though. So we'll never know which it is actually rolling.

shannonmcmaster ,
@shannonmcmaster@dice.camp avatar

@epidiah

"way back when"

epidiah OP ,
@epidiah@dice.camp avatar

@shannonmcmaster The golden months.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines