

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.
Related Posts

Technical Analysis: 4 Stocks with signs of death crossovers to keep an eye on

HDFC Bank & 3 other fundamentally strong stocks trading above 200 DMA to keep an eye on

Falling Channel Breakout: Multibagger NBFC Stock Shows Bullish Momentum on Daily Chart

4 Fundamentally strong stocks to buy for an upside potential of up to 36%; Do you hold any?

0 responses on "Bash vs. Python"