A system bet is basically a bet k out of n, where k thus indicates the number of games per combination bet and n the number of games. K out of n indicates the number of k permutations of an n-element set and is thus written as n over k. The number is calculated according to the familiar pattern in the numerator n * ( n – 1) * (n – 2) * …, and of these elements there are k pieces, while in the denominator there is simply k factorial. Of course, these bets must be broken down individually in a programme and each evaluated separately. However, there is also the possibility of including banks. These do not increase the number of possibilities, yet they must be handled carefully here.
It is a matter of calculating system bets cleanly, determining their value, the profit expectation (“equity” sounds better here; because one could also have a negative profit expectation, which would then have to be called loss expectation), payout possibilities as well, which can also be partly determined by games already played, but could also possibly be fed by live results and thus contain a “what if” analysis. At the same time, one can make a comparison of the value of the bets under different assumptions of the probabilities of occurrence of the individual events. These are not known, so it remains a matter of assumptions. A system betting calculator must also always have a good suggestion as to what would be a fair cashout.
The Asian handicap is missing from the programme. In Asian terms, there are five possible outcomes for all tips (here we really mean a SINGLE tip, not a system bet; the term “bet events” would be more appropriate). Traditionally, there are the outcomes “won” and “lost” for a tip. It is right or it is wrong. In Asia, there are the other three outcomes, over and above the conventional one. Let’s rather use the terminology of single bets here: a single bet can still be won or lost. This has not changed in Asia. In addition, there are the outcomes: half a loss, par and half a win. With half a loss, you actually lose half the bet, half the stake. At par, you get exactly your money back. If you win half, you win half of the bet. But that means only half of the possible profit. So you have to multiply half the stake by ( odds – 1 ) to calculate the profit. For the calculation in the programme, one would have to add the values for these three outcomes like this: lost is 0. One loses the entire bet. Half loss would be 0.25. Pari would be 0.5. Half win would be a value of +1.
AusDoCalc is called and all parameters are passed to this function. The result is returned in erg and is still to be read out. In total there are 12 (in words: twelve) interesting result queries.
//OutDoCalc4D
// ->$1 = odds array
// ->$2 = probs array
// ->$3 = in – array
// ->$4 = ARRAY REAL(erg;12)
// ->$5 = GameKeyNumber
// ->$6 = number of bets
C_BOOLEAN($fir;$stop)
_o_C_INTEGER($i,$j,$anz,$combiTotal,$ite)
C_REAL($maxOut)
ARRAY INTEGER($combi;0)
ARRAY INTEGER($komInd;0)
ARRAY INTEGER($Ind;0)
//Determine which bets are 2s
//is involved. The bets of 2 must follow one after the other
$anz:=$6
For ($i;1;$anz)
If ($i=$anz)
INSERT IN ARRAY($Ind;1)
$Ind{Size of array($Ind)}:=$i
Else
If ($5->{$i}=$5->{$i+1})
INSERT IN ARRAY($combined;100;1)
INSERT IN ARRAY($komInd;100;1)
$komInd{Size of array($kombi)}:=$i
$i:=$i+1
Else
INSERT IN ARRAY($Ind;100;1)
$Ind{Size of array($Ind)}:=$i
End if
End if
End for
$kombiAnz:=Size of array($kombi)
If ($combiTotal=0)
$0:=AusDoCalc ($1->;$2->;$3->;$4->)
Else
$0:=0
$maxAusz:=0
$ite:=Size of array($3->)
ARRAY REAL($odds;$ite)
ARRAY REAL($prob;$ite)
ARRAY LONGINT($in;$ite)
For ($i;1;$ite)
$odds{$i}:=$1->{$i}
$prob{$i}:=$2->{$i}
$in{$i}:=$3->{$i}
End for
ARRAY REAL($erg;Size of array($4->))
For ($i;1;Size of array($erg))
$erg{$i}:=0
End for
//Are bank bets available?
If ($anz<Size of array($1->))
For ($j;$anz+1;Size of array($1->))
$ite:=$j-$kombiAnz //Bank must move forward
$1->{$ite}:=$odds{$j}
$2->{$ite}:=$prob{$j}
$3->{$ite}:=$in{$j}
End for
End if
//All combinations are determined one after the other
$fir:=True
$i:=$combiTotal
While ($i>0)
If ($fir=True) //Beginning initialisation
For ($j;1;$combiNumber)
$combi{$j}:=0
End for
$fir:=False
Else //Calculate the next combination
$stop:=False
$i:=$combiTotal
While ((Not($stop)) & ($i>0))
If ($combi{$i}=0)
$kombi{$i}:=1 //2. way is to be set now
$stop:=True
$j:=$i+1
While ($j<=$combi{$i})
$kombi{$j}:=0 //1st way should be set now
$j:=$j+1
End while
Else
$i:=$i-1
End if
End while
End if
If ($i>0)
//Now you can calculate the values for a combination.
//The transfer array still has to be set
For ($j;1;$kombiAnz+Size of array($Ind))
If ($j<=$kombiAnz)
$ite:=$komInd{$j}
If ($combi{$j}=1)
$ite:=$ite+1 //2. take way
End if
Else
$ite:=$ind{$j-$kombiAnz}
End if
$1->{$j}:=$odds{$ite}
$2->{$j}:=$prob{$ite}
$3->{$j}:=$in{$ite}
End for
$0:= ($1->;$2->;$3->;$4->)
For ($j;1;Size of array($erg))
$erg{$j}:=$erg{$j}+$4->{$j}
End for
If ($4->{3}>$maxAusz)
$maxAusz:=$4->{3}
End if
End if
End while
$erg{3}:=$maxAusz
For ($i;1;Size of array($erg))
$4->{$i}:=$erg{$i}
End for
End if
C_LONGINT($from;$to)
Open window(30;30;390;155;1)
DIALOG([BMQuoten]; “Search”)
CLOSE WINDOW
Case of
: (xRet=3)
// If (◊gSelKey>=0)
QUERY([game week];[game week]WochenID=gWochenID)
RELATE MANY([game week]WeekID)
SetGmSel
SELECTION TO ARRAY([games]game_key_no;aGOgamekey)
$len:=Size of array(aGOgamekey)
_o_ARRAY STRING(15;aGOHomeName;$len)
_o_ARRAY STRING(15;aGOAuswName;$len)
_o_ARRAY STRING(15;aBM;25)
ARRAY REAL(aBM1;$len)
ARRAY REAL(aBM2;$len)
ARRAY REAL(aBM3;$len)
ARRAY REAL(aBM4;$len)
ARRAY REAL(aBM5;$len)
ARRAY REAL(aBM6;$len)
ARRAY REAL(aBM7;$len)
ARRAY REAL(aBM8;$len)
ARRAY REAL(aBM9;$len)
ARRAY REAL(aBM10;$len)
ARRAY REAL(aBM11;$len)
ARRAY REAL(aRound;$len)
ARRAY INTEGER(aErg1;$len)
ARRAY INTEGER(aErg2;$len)
ARRAY LONGINT(aSpNr;$len)
For ($i;1;25)
aBM{$i}:=””
End for
For ($i;1;Size of array(aGOgamekey))
aBM1{$i}:=0
aBM2{$i}:=0
aBM3{$i}:=0
aBM4{$i}:=0
aBM5{$i}:=0
aBM6{$i}:=0
aBM7{$i}:=0
aBM8{$i}:=0
aBM9{$i}:=0
aBM10{$i}:=0
aBM11{$i}:=0
End for
$anf:=1
TRACE
For ($i;1;Size of array(aGOgamekey))
QUERY([games];[games]game_key_no=aGOgamekey{$i})
RELATE ONE([games]team ID 1)
aGOHomeName{$i}:=[teams]short name
RELATE ONE([games]team ID 2)
aGOAuswName{$i}:=[teams]short name
aRound{$i}:=[games]roundnr
aSpNr{$i}:=[games]gamenumber
aErg1{$i}:=[games]result team1
aErg2{$i}:=[games]result team2
CalcQuotVergl (0)
//erg aBMName;aBMWinValue
For ($k;1;Size of array(aBMName))
$j:=1
$find:=False
While (($j<=Size of array(aBM)) & Not($find))
If (aBM{$j}=aBMName{$k})
$find:=True
Else
$j:=$j+1
End if
End while
If ($find=False)
aBM{$anf}:=aBMName{$k}
$j:=$anf
$anf:=$anf+1
End if
Case of
: ($j=1)
aBM1{$i}:=aBMWinValue{$k}
: ($j=2)
aBM2{$i}:=aBMWinValue{$k}
: ($j=3)
aBM3{$i}:=aBMWinValue{$k}
: ($j=4)
aBM4{$i}:=aBMWinValue{$k}
: ($j=5)
aBM5{$i}:=aBMWinValue{$k}
: ($j=6)
aBM6{$i}:=aBMWinValue{$k}
: ($j=7)
aBM7{$i}:=aBMWinValue{$k}
: ($j=8)
aBM8{$i}:=aBMWinValue{$k}
: ($j=9)
aBM9{$i}:=aBMWinValue{$k}
: ($j=10)
aBM10{$i}:=aBMWinValue{$k}
End case
End for
End for
vDoc:=Create document("")
If (ok#0)
$Packet:="Spt"+Char(9)+"Heim"+Char(9)+"Auswärts"+Char(9)+"Erg1"+Char(9)+"Erg2"+Char(9)+aBM{1}+Char(9)+aBM{2}+Char(9)+aBM{3}+Char(9)
$Packet:=$Packet+aBM{4}+Char(9)+aBM{5}+Char(9)+aBM{6}+Char(9)+aBM{7}+Char(9)
$Packet:=$Packet+aBM{8}+Char(9)+aBM{9}+Char(9)+aBM{10}+Char(13)
SEND PACKET(vDoc;$Packet)
For ($i;1;Size of array(aGOHeimName))
$Packet:=String(aRound{$i})+Char(9)+aGOHeimName{$i}+Char(9)
$Packet:=Insert string($Packet;aGOAuswName{$i}+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aErg1{$i})+Char(9)+String(aErg2{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM1{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM2{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM3{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM4{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM5{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM6{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM7{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM8{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM9{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;String(aBM10{$i})+Char(9);Length($Packet)+1)
$Packet:=Insert string($Packet;Char(13);Length($Packet)+1)
SEND PACKET(vDoc;$Packet)
End for
CLOSE DOCUMENT(vDoc)
End if
SetListHeaders ("Nr.";"Heim";"Auswärts";aBM{1};aBM{2};aBM{3};aBM{4};aBM{5};aBM{6};aBM{7};aBM{8};aBM{9};aBM{10})
SetListButtons ("";"-";"")
SetListSize (400;640;0)
SetListWidths (25;75;75;50;50;50;50;50;50;50;50;50;50)
$line:=DisplayList (aSpNr;aGOHeimName;aGOAuswName;aBM1;aBM2;aBM3;aBM4;aBM5;aBM6;aBM7;aBM8;aBM9;aBM10)
// End if
: (xRet=2)
READ ONLY([games])
// BEEP
//
QUERY([game week];[game week]WochenID=gWochenID)
RELATE MANY([game week]WeekID)
SetGmSel
// SelectGames (◊gSelKey)
// SelGameArray
CalcQuotVergl (1)
: (xRet=1)
QUERY([game week];[game week]abbreviation=vFromWWo)
If (records in selection([game week])=1)
$of:=[game week]WeekID
QUERY([game week];[game week]abbreviation=vByWWo)
If (records in selection([game week])=1)
$To:=[game week]WeekID
C_BOOLEAN(<>vCancel)
<>vCancel:=False
ON EVENT CALL("Stop")
READ ONLY([games])
$len:=$to-$from+2
ARRAY REAL(aDirkErg;$len)
ARRAY REAL(aBM1Erg;$len)
ARRAY REAL(aBM2Erg;$len)
ARRAY REAL(aBM3Erg;$len)
ARRAY REAL(aBM4Erg;$len)
ARRAY REAL(aBM5Erg;$len)
ARRAY REAL(aBM6Erg;$len)
ARRAY REAL(aBM7Erg;$len)
ARRAY REAL(aBM8Erg;$len)
ARRAY REAL(aBM9Erg;$len)
ARRAY REAL(aBM10Erg;$len)
ARRAY REAL(aBM11Erg;$len)
ARRAY REAL(aBM12Erg;$len)
ARRAY REAL(aBM13Erg;$len)
ARRAY REAL(aBM14Erg;$len)
ARRAY REAL(aBM15Erg;$len)
ARRAY REAL(aBM16Erg;$len)
ARRAY REAL(aBM17Erg;$len)
ARRAY REAL(aBM18Erg;$len)
ARRAY REAL(aBM19Erg;$len)
ARRAY REAL(aBM20Erg;$len)
ARRAY REAL(aBM21Erg;$len)
ARRAY REAL(aBM22Erg;$len)
ARRAY REAL(aBM23Erg;$len)
ARRAY REAL(aBM24Erg;$len)
ARRAY REAL(aBM25Erg;$len)
ARRAY TEXT(aWochShort;$len)
For ($i;1;$len)
aDirkErg{$i}:=0
aBM1Erg{$i}:=0
aBM2Erg{$i}:=0
aBM3Erg{$i}:=0
aBM4Erg{$i}:=0
aBM5Erg{$i}:=0
aBM6Erg{$i}:=0
aBM7Erg{$i}:=0
aBM8Erg{$i}:=0
aBM9Erg{$i}:=0
aBM10Erg{$i}:=0
aBM11Erg{$i}:=0
aBM12Erg{$i}:=0
aBM13Erg{$i}:=0
aBM14Erg{$i}:=0
aBM15Erg{$i}:=0
aBM16Erg{$i}:=0
aBM17Erg{$i}:=0
aBM18Erg{$i}:=0
aBM19Erg{$i}:=0
aBM20Erg{$i}:=0
aBM21Erg{$i}:=0
aBM22Erg{$i}:=0
aBM23Erg{$i}:=0
aBM24Erg{$i}:=0
aBM25Erg{$i}:=0
aWeekShort{$i}:=""
End for
ARRAY INTEGER(aAllBMInd;26)
ARRAY TEXT(aAllBMName;26)
For ($i;1;26)
aAllBMInd{$i}:=-1
aAllBMName{$i}:=""
End for
aWeekShort{$len}:="Sum:"
For ($week;$from;$to)
If (<>vCancel)
ALERT("Selection cancelled at week "+[game week]Name)
$week:=$to+1
Else
QUERY([game week];[game week]WeekID=$week)
MESSAGE("WeekID: "+String($week)+" to "+String($to))
// QUERY([Selection];[Selection]WeekID=$week)
// If (Records in selection([Selection])>1)
// If ([Selection]name≤1≥ # "W")
// NEXT RECORD([Selection])
// End if
// End if
// SelectGames ([Selection]key)
// SelGameArray
RELATE MANY([Game Week]WeekID)
SetGmSel
CalcQuotVergl (0)
// Evaluate variables from "CalcQuotVergl
$ind:=$week-$from+1
aWeekShort{$ind}:=[game week]abbreviation
For ($i;1;Size of array(aBMWinValue))
If ((aBMIndex{$i}#0) | ($i=1))
$k:=1
While ((aBMIndex{$i}#aAllBMInd{$k}) & (aAllBMInd{$k}#-1))
$k:=$k+1
End while
If (aAllBMInd{$k}=-1)
aAllBMInd{$k}:=aBMIndex{$i}
aAllBMName{$k}:=aBMName{$i}
End if
Case of
: ($k=1)
aDirkErg{$ind}:=aBMWinValue{$i}
aDirkErg{$len}:=aDirkErg{$len}+aBMWinValue{$i}
Else
C_POINTER(ptrAGMErg)
ptrAGMErg:=Get pointer("aBM "+String($k-1)+"Erg")
ptrAGMErg->{$ind}:=aBMWinValue{$i}
ptrAGMErg->{$len}:=ptrAGMErg->{$len}+aBMWinValue{$i}
//: ($k=2)
// aBM1Erg{$ind}:=aBMWinValue{$i}
// aBM1Erg{$len}:=aBM1Erg{$len}+aBMWinValue{$i}
// : ($k=3)
// aBM2Erg{$ind}:=aBMWinValue{$i}
// aBM2Erg{$len}:=aBM2Erg{$len}+aBMWinValue{$i}
End case
End if
End for
End if
End for
ON EVENT CALL("")
DIALOG([BMQuoten]; "ArchTabelle")
End if
End if
SET WINDOW TITLE(ActTitle)
End case
short DoCalc (InternDataPtr data, PA_Variable odds, PA_Variable probPtr, PA_Variable in, PA_Variable erg)
{
ODDS_LIST Bet[MAX_ELEM];
long List[MAX_ELEM];
long PrintList[MAX_ELEM];
long intCount;
long n, k, baenke;
long *IndexList = (data->indexList);
long i, j;
long count;
// double Odds;
// long event_came;
double Prod;
double MaxSum;
double PossibleSum;
double ActualSum;
long BetWon;
double BasicBet = data->basicBet;
long option = data->option;
double prob;
double MoneyExp = (data->moneyExp);
double MoneyExpSum;
double ActualMoneyExp = (data->actualMoneyExp);
double ActualMoneyExpSum;
double prob_for_all;
long arrived = 0;
// double prob_for_any_money;
double Taxes = data->taxes;
double ValueOfBet, BetValueProd;
// TestStr1 (“\pin : “, odds [1].fValue * 10000);
n = data->n;
k = data->k;
baenke = data->baenke;
//TestStr1 (“\p calc >>>k “, k);
/*
TestStr1 (“\p calc >>>n “, n);
TestStr1 (“\p calc >>> IndexList “, (long) IndexList);
TestStr1 (“\p calc >>> Bet “, (long) &Bet);
TestStr1 (“\p odd1 “, odds[1] * 1000);
TestStr1 (“\p odd2 “, odds[2] * 1000);
TestStr1 (“\p pro1 “, probPtr[1] * 1000);
TestStr1 (“\p pro2 “, probPtr[2] * 1000);
TestStr1 (“\p i1 “, in[1]);
TestStr1 (“\p i2 “, in[2]);
*/
HLock ((Handle ) data->moneyExp);
HLock ((Handle ) data->actualMoneyExp);
HLock ((Handle ) data->indexList);
for ( i=0; i<n + banks; i++)
{
if (option == 0)
{
Bet[i].odds = PA_GetRealInArray (odds, i+1);
Bet[i].prob = 1 / Bet[i].odds;
Bet[i].event_came_true = 1;
}
else
if (option == 1)
{
Bet[i].odds = PA_GetRealInArray (odds, i+1);
Bet[i].prob = PA_GetRealInArray (probPtr, i+1); // probPtr[i+1];
Bet[i].event_came_true = 1;
}
else
if (option == 2)
{
Bet[i].odds = PA_GetRealInArray (odds, i+1);
Bet[i].prob =PA_GetRealInArray (probPtr, i+1); // probPtr[i+1];;
Bet[i].event_came_true = PA_GetLongintInArray (in, i+1); //in[i+1];
}
else
{
SysBeep (3);
return -1;
}
}
for ( i=0; i<n; i++ )
List[i] = i;
for ( i=0; i<k; i++ )
PrintList[i] = i;
intCount = 0;
Count = Outdatf (&intCount, n, k, List, PrintList, IndexList, k, 0, 0);
// fprintf ( outdat, “&intCount odds with probabilities : &int” );
// fprintf ( outdat, “\t======================================\n\n” );
// fprintf ( outdat, “\tQuote\tW-keit\teingroffen\n” );
// for ( i=0; i<n; i++ )
// fprintf ( outdat, “\t%4.2f%4.2f %%\t%d\n”
// bet[i].odds, 100 * bet[i].prob, bet[i].event_came_true );
// fprintf ( outdat, “\n” );
// fprintf ( outdat, “\n\n%d over %d = %d\n\n”, n, k, count );
arrived = 0;
prob_for_all = 1;
for ( i=0; i<n+beans; i++ )
{
prob_for_all *= bet[i].prob;
arrived++;
}
MoneyExpSum = 0;
ActualMoneyExpSum = 0;
// fprintf ( outdat, “\tW-ness\tCorrect\tMoneyExpectation\tMoneyExpectationSum\n” );
// Calculate Money Exp not considering whether or not events came true.
for ( i=0; i<number; i++ )
{
Prod = 1;
prob = 1;
for ( j=0; j<k; j++ )
{
Prod *= bet[IndexList[i][j]].odds;
prob *= bet[IndexList[i][j]].prob;
}
for ( j=n; j<n+baenke; j++ )
{
Prod *= bet[j].odds;
prob *= bet[j].prob;
}
/*
- The winning odds are calculated as follows :
In the case of prob, the payout is basic bet Prod, but the basic bet must be - must be subtracted again for the profit expectation in case of net calculation.
- Taxes are given as a percentage, they are deducted from the total payout.
- In case of not prob, i.e. the cases 1-prob, one loses the basic stake.
/ MoneyExp[i] = prob ( basic stake (Prod-1) – !(data->pre-tax)base stakeprodtax ) –
( 1 – prob ) * base stake;
MoneyExpSum = MoneyExpSum + MoneyExp[i];
}
MoneyExpSum -= data->pre-tax data->tax data->stake;
// Calculate the Maximum money to be paid out.
MaxSum = 0;
for ( i=0; i<number; i++ )
{
Prod = 1;
for ( j=0; j<k; j++ )
{
Prod = bet[IndexList[i][j]].odds*Prod;
}
for ( j=n; j<n+baenke; j++ )
Prod *= Bet[j].odds;
MaxSum += Prod;
}
MaxSum -= !(data->pre-tax) data->tax MaxSum;
/*
- Calculate the possible money to be paid out.
*/
PossibleSum = 0;
for ( i=0; i<number; i++ )
{
BetWon = true;
for ( j=0; j<k; j++ )
{
if ( !Bet[IndexList[i][j]].event_came_true )
BetWon = false;
}
for ( j=n; j<n+baenke; j++ )
{
if ( !Bet[j].event_came_true )
BetWon = false;
}if ( BetWon ) { Prod = 1; for ( j=0; j<k; j++ ) { Prod = Bet[IndexList[i][j]].odds*Prod; } for ( j=n; j<n+baenke; j++ ) Prod *= Bet[j].odds; PossibleSum += Prod; }
}
PossibleSum -= !(data->pre-tax) data->tax PossibleSum;
/*
- Calculate the Actual money to be paid out.
*/
ActualSum = 0;
for ( i=0; i<number; i++ )
{
BetWon = true;
for ( j=0; j<k; j++ )
{
if ( Bet[IndexList[i][j]].event_came_true != 1 )
BetWon = false;
}
for ( j=n; j<n+baenke; j++ )
{
if ( bet[j].event_came_true != 1 )
BetWon = false;
}if ( BetWon ) { Prod = 1; for ( j=0; j<k; j++ ) { Prod = Bet[IndexList[i][j]].odds*Prod; } for ( j=n; j<n+baenke; j++ ) Prod *= Bet[j].odds; ActualSum += Prod; }
}
if (!(data->pre-tax))
ActualSum -= data->tax * ActualSum;
/*
- Calculate the actual money expectation. This is relevant only if
- some of the events are still “open”.
*/ ValueOfBet = Number*BaseStake;
/*
First, the w-nesses of all games are set to 1 or 0 in * case the games have already taken place.
- the case that the games have already taken place. DP, 29-04-95.
*/ for ( j=0; j<n+baenke; j++ )
{
if ( bet[j].event_came_true == 1 )
Bet[j].prob = 1;
if ( bet[j].event_came_true == 0 )
Bet[j].prob = 0;
} for ( i=0; i<number; i++ )
{
/* commented out because all w-nesses are set to 1 or 0 above.
- DP, 29-04-95.
for ( j=0; j<k; j++ )
{
if ( Bet[IndexList[i][j]].event_came_true == 1 )
Bet[IndexList[i][j]].prob = 1;
if ( bet[IndexListe[i][j]].event_came_true == 0 )
Bet[IndexList[i][j]].prob = 0;
}
*/BetWon = true; for ( j=0; j<k; j++ ) { if ( ! Bet[IndexList[i][j]].event_came_true ) { BetWon = false; break; } } for ( j=n; j<n+baenke; j++ ) { if ( !bet[j].event_came_true ) { BetWon = false; break; } } if ( BetWon ) { Prod = 1; prob = 1; BetValueProd = 1; for ( j=0; j<k; j++ ) { Prod *= bet[IndexList[i][j]].odds; prob *= bet[IndexList[i][j]].prob; if ( bet[IndexList[i][j]].event_came_true == 1 ) BetValueProd *= Bet[IndexList[i][j]].odds; } for ( j=n; j<n+bets; j++ ) { Prod *= bet[j].odds; prob *= bet[j].prob; if ( bet[j].event_came_true == 1 ) BetValueProd *= Bet[j].odds; } ActualMoneyExp[i] = prob ( base bet (Prod-1) - !(data->pre-tax)*base stake*prod*taxes ) - ( 1 - prob ) * base stake; ValueTheBet = ValueTheBet + (BetValueProd-1) * BaseBet; } else { ActualMoneyExp[i] = -base stake; ValueBet -= BaseBet; Prod = 0; prob = 0; } ActualMoneyExpSum += ActualMoneyExp[i];
}
ActualMoneyExpSum -= data->pre-tax data->tax data->use;
if (!data->pre-tax)
ValueOfBet -= data->tax * ValueOfBet;
/*
fprintf ( outdat, “\nMaxPayout = %7.2f * %7.2f = %7.2f\n”,
MaxSum, Base Bet, MaxSum*Base Bet );
fprintf ( outdat, “\nMaximum possible payout = %7.2f * %7.2f = %7.2f\n”,
PossibleSum, Base Bet, PossibleSum*Base Bet );
fprintf ( outdat, “\nActualPayout = %7.2f * %7.2f = %7.2f\n”,
ActualSum, Base Bet, ActualSumBase Bet ); fprintf ( outdat, “W-ness all %d events = %8.6f %%\n”, arrived, 100prob_for_all );
fprintf ( outdat, “Total bet = %6.2f\n”
“Original money expectation = %6.2f\n”
“Benefit = %4.2f %%\n”,
Base Bet * Quantity,
MoneyExpSum,
100 MoneyExpSum / ( base stake number ) );
fprintf ( outdat, “Instantaneous money expectation = %6.2f\n”
“Instantaneous Advantage = %4.2f %%\n”,
ActualMoneyExpSum,
100 ActualMoneyExpSum / ( basic stake number ) );
for ( j=0; j<n; j++ )
fprintf ( ExcelFile, "\n" );
fprintf ( ExcelFile, "%6.2f\t%7.2f\n",
ActualMoneyExpSum, MaxSum*base stake );
*/
PA_SetRealInArray (erg, 1, MaxSum);
PA_SetRealInArray (erg, 2, base stake);
PA_SetRealInArray (erg, 3, MaxSum*BaseInput);
PA_SetRealInArray (erg, 4, PossibleSum);
PA_SetRealInArray (erg, 5, PossibleSum*BaseInput);
PA_SetRealInArray (erg, 6, ActualSum);
PA_SetRealInArray (erg, 7, ActualSum*BasicSum);
PA_SetRealInArray (erg, 8, arrived);
PA_SetRealInArray (erg, 9, 100*prob_for_all);
PA_SetRealInArray (erg, 10, MoneyExpSum);
PA_SetRealInArray (erg, 11, ActualMoneyExpSum);
PA_SetRealInArray (erg, 12, ValueOfBet);
/*
erg [1] = MaxSum;
erg [2] = BasicBet;
erg [3] = MaxSumBaseBet; erg [4] = PossibleSum; erg [5] = PossibleSumBaseSum;
erg [6] = ActualSum;
erg [7] = ActualSumbase rate; erg [8] = arrived; erg [9] = 100prob_for_all;
erg [10] = MoneyExpSum;
erg [11] = ActualMoneyExpSum;
erg [12] = ValueOfBet;
*/
HUnlock ((Handle ) data->moneyExp);
HUnlock ((Handle ) data->actualMoneyExp);
HUnlock ((Handle ) data->indexList);
return noErr;
}