mgale: generate Martingale progressions
M. J. Shannon
mjs at s4mjs.UUCP
Sat Jan 5 11:45:18 AEST 1991
Submitted-by: mjs at s4mjs.uucp
Archive-name: mgale/part01
#!/bin/sh
# This is mgale, a shell archive (shar 3.32)
# made 01/05/1991 00:40 UTC by mjs at s4mjs
# Source directory /u/mjs/acc
#
# existing files will NOT be overwritten
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1102 -rw-r--r-- README
# 1463 -rw-r--r-- mgale.c
#
if touch 2>&1 | fgrep 'amc' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= README ==============
if test X"$1" != X"-c" -a -f 'README'; then
echo "File already exists: skipping 'README'"
else
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
Xmgale is a program to compute `sensible' Martingale betting
Xprogressions. It permits specifying:
X
X minimum bet (-b)
X bet increment (-i)
X maximum bet (-m)
X payoff odds (-o)
X stake (-s)
X minimum win (-w)
X
Xall on the command line. I use it when I play roulette to generate any
Xnumber of progressions tuned how I wish to play. Most often, the
Xvariation I play by is generated by something like:
X
X mgale -b15 -i15 -m300 -o11 -s1000 -w0
X
Xwhich defines a table with a $5 minimum and $100 maximum, where I will
Xplay 3 different numbers straight up with my stake of $1000, and I'll
Xaccept a win that will only cover the bets made in that sequence.
X
XFor more information on Martingale systems, consult any useful book on
Xgambling, particularly one that covers roulette.
X
XI don't recommend using such a system unless you have some method of
Xpicking winning numbers that does better than random (or if you find a
Xwheel that's unbalanced in such a way that sitting on a set of numbers
Xwill do the same).
X
XIt is interesting to see betting sequences with a negative minimum win.
X
XBet with their money, not yours!
SHAR_EOF
$TOUCH -am 0104194091 README &&
chmod 0644 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "1102"; then
echo original size 1102, current size $Wc_c
fi
fi
# ============= mgale.c ==============
if test X"$1" != X"-c" -a -f 'mgale.c'; then
echo "File already exists: skipping 'mgale.c'"
else
echo "x - extracting mgale.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > mgale.c &&
X#include <stdio.h>
X
Xint OPT_b; int OPT_i; int OPT_o; int OPT_m; int OPT_s; int OPT_w;
Xchar use_mess[] = "-b{et} -i{ncrement} -m{ax bet} -o{dds} -s{take} -w{in}";
X
Xint
Xmain(argc, argv)
Xint argc;
Xchar** argv;
X{
X int betnum; int bet; int down = 0; int profit; int c;
X extern char* optarg;
X
X while ((c = getopt(argc, argv, "b:i:m:o:s:w:")) != EOF)
X {
X switch (c)
X {
X case 'b': OPT_b = atoi(optarg); break;
X case 'i': OPT_i = atoi(optarg); break;
X case 'm': OPT_m = atoi(optarg); break;
X case 'o': OPT_o = atoi(optarg); break;
X case 's': OPT_s = atoi(optarg); break;
X case 'w': OPT_w = atoi(optarg); break;
X default: case '?':
X fprintf(stderr, "%s: Usage: %s %s\n",
X argv[0], argv[0], use_mess);
X return 2;
X }
X }
X if (OPT_b <= 0) OPT_b = 1;
X if (OPT_i <= 0) OPT_i = 1;
X if (OPT_m <= 0) OPT_m = 100;
X if (OPT_o <= 0) OPT_o = 11;
X if (OPT_s <= 0) OPT_s = 100;
X
X printf("Stake: %d\n", OPT_s);
X printf("Min bet: %d\n", OPT_b);
X printf("Bet incr: %d\n", OPT_i);
X printf("Bet pays: %d\n", OPT_o);
X printf("Max bet: %d\n", OPT_m);
X printf("Min profit: %d\n\n", OPT_w);
X printf("# Bet Down Prof Avg\n");
X for (betnum = 1, bet = OPT_b, down = bet, c = 0;
X bet <= OPT_m && down < OPT_s; ++betnum)
X {
X profit = (bet * (OPT_o + 1)) - down;
X c += profit;
X printf("%2d %5d %5d %5d %5d\n",
X betnum, bet, down, profit, c / betnum);
X while ((bet * (OPT_o + 1)) < (down + bet + OPT_w))
X bet += OPT_i;
X down += bet;
X }
X return 0;
X}
SHAR_EOF
$TOUCH -am 0104192191 mgale.c &&
chmod 0644 mgale.c ||
echo "restore of mgale.c failed"
set `wc -c mgale.c`;Wc_c=$1
if test "$Wc_c" != "1463"; then
echo original size 1463, current size $Wc_c
fi
fi
exit 0
--
--------------+ <Delapsus Resurgam: When I fall I shall rise. --(10cc)>
Marty Shannon | My opinions are just that. You may share them. No one
mjs at s4mjs.uucp| speaks for me, and I speak only for myself -- no matter
--------------+ where I post from. Get it? Post no flames.
More information about the Alt.sources
mailing list