Categories: General

Bash vs. Python

top-ten-programming-languages1.1top-ten-programming-languages1.1

A buddy of mine asked me a couple days ago if it’d be possible to write a
program that rolled dice and dealt with the results in a certain way. Seeing
this as an opportunity to dabble in some programming I naturally replied
that 1) Yes, it’s possible, and 2) I’ll do it for you.

The obvious choice for the job was
Python.

Anyway, the task took an embarassingly long time (over 3 hours), but I
didn’t feel bad about it considering my limited programming experience.
Plus, the old saying about only getting good at programming by doing it is
quite true.

At any rate, here’s what I came up with for the basic task, which was to
roll 2-9 d6 and add the two highest rolls. From here I’m going to add the
ability to provide a second argument that determines how many times the roll
with x number of dice will be made. That version will also keep a running
average of the totals from each roll.

[
https://github.com/danielmiessler/diceroll
]

Gerald Businge

Leave a Comment
Share
Published by
Gerald Businge

Recent Posts

Dulce de Leche Granizado Ice Cream

Having studied Spanish for over 6 years, I knew what dulce de leche meant. Sweet.…

1 month ago

Kiwi Lime Sorbet

I found kiwis on sale. Five for $1! In the middle of winter. In January.…

1 month ago

Ghirardelli Chocolate Market Street San Francisco

An experience. That’s what Ghirardelli is to me. For many years, San Francisco was a…

1 month ago

Eucalyptus Ice Cream

The challenge: Bring something with a foraged ingredient. My answer: Eucalyptus. Eucalyptus ice cream! Large…

1 month ago

Celery Ice Cream with Rum-Plumped Raisins and Peanut Butter Swirl

Celery ice cream? It got me thinking. Celery? Green. Usually eaten raw. Almost tasteless, but…

1 month ago

Cookiebar Creamery Oakland

“A cookie must melt at the same rate as the ice cream,” an ice cream…

1 month ago