Dice Roller Updates

Since I’ve been working on unifying my website, I decided that I would take some time to update some of the other sections of my site while I was at it. The first thing that I wanted to work on was my dice roller – this is probably some of the oldest working perl code that I have, and it shows. It has some fairly obvious security flaws, an inflexible persistence model, and is lacking some options I’ve wanted for a while.

So, I’ve decided to update the code. Since it’s less than 150 lines of code, it should be easy to rewrite from scratch, so that’s my initial plan. Here is my feature list, in priority order:

  1. Rewrite the rolling engine:
    1. Strip the CGI parameter for id – I don’t have a use case for multiple dice rollers anymore.
    2. Sanitize input.
    3. Update storage model for rolls.  (Used Storable)
  2. Rewrite the display engine:
    1. Strip the template parameter – This is a security hole and I don’t have a use case for it anymore.
    2. Sanitize output.
    3. Find a better way to import templates.  (used HTML::Template)
  3. Do better session management
    1. Keep the user’s options so they don’t have to retype them every time.
    2. Explore cookies or CGI sessions for this.  (Used CGI::Session and cookies)
  4. Unify my Gaussian dice roller via options rather than a separate script.
  5. Provide options for counting dice over a threshold (like World of Darkness “successes”).
  6. Provide options for getting the total value of the dice (lots of games do this).
  7. Explore output filters
    1. Name
    2. Game name?
  8. Provide options for glyph dice (Star Wars).
  9. Provide options for exploding dice.

And, as it turns out, it took me longer to write this post than it did to update.  Here it is!

Category(s): Programming
Tags: ,

Comments are closed.