There are a lot of Unix/Lunix scripting tools out in the wild. Microsoft is trying to bring some sanity to the world.
Sanity? I'd call it hegemony. If they'd simply port the commands to Linux, bash would be all we'd need. You can pretty much do anything with Bash.
Here's a bash script that will play a round of Bunco...
#!/bin/bash
rolldie()
{
local result=$1
rolled=$(( ( $RANDOM % 6 ) + 1 ))
eval $result=$rolled
}
BuncoRound()
{
# roll, display, and score a round of bunco!
# round is specified when invoked, score added to totalscore
local score=0 ; local round=$1 ; local hidescore=0
rolldie die1 ; rolldie die2 ; rolldie die3
echo Round $round. You rolled: $die1 $die2 $die3
if [ $die1 -eq $die2 ] && [ $die2 -eq $die3 ] ; then
if [ $die1 -eq $round ] ; then
echo " BUNCO! You score 21!"
score=21
hidescore=1
else
echo " Mini Bunco! You score 5!"
score=5
hidescore=1
fi
else
if [ $die1 -eq $round ] ; then
score=1
fi
if [ $die2 -eq $round ] ; then
score=$(( $score + 1 ))
fi
if [ $die3 -eq $round ] ; then
score=$(( $score + 1 ))
fi
fi
if [ $hidescore -eq 0 ] ; then
echo " score this round: $score"
fi
totalscore=$(( $totalscore + $score ))
}
for round in {1..6} ; do
BuncoRound $round
done
echo "Total Score: $totalscore"
For example:
$ bunco Round 1. You rolled: 2 4 1 score this round: 1 Round 2. You rolled: 6 1 6 score this round: 0 Round 3. You rolled: 2 3 2 score this round: 1 Round 4. You rolled: 4 1 5 score this round: 1 Round 5. You rolled: 3 3 3 Mini Bunco! You score 5! Round 6. You rolled: 1 5 3 score this round: 0 Total Score: 8