Log in

View Full Version : Calculating Quinella bets


Michal
29th October 2008, 07:04 AM
Hi,

I always thought of my self as inteligent, well untill today LOL. Im trying to write a program that calculates the cost of quinella and I cant figure out the formula.

could someone help me work out this
1
1,2,3,4,5,6,7

1,2,
1,2,3,4,5,6,7

1,2,3
1,2,3,4,5,6,7

1,2,3,4
1,2,3,4,5,6,7

1,2,3,4,5,
1,2,3,4,5,6,7

1,2,3,4,5,6
1,2,3,4,5,6,7

1,2,3,4,5,6,7
1,2,3,4,5,6,7

they are supposed to cost

$6
$11
$15
$18
$20
$21
$21


I cant figure out the correct algorithm that will produce these outcomes. I also feel quite stupid at the moment :)

Thanks

Michal

Michal
29th October 2008, 07:38 AM
Hi ,


Figured it out myself I had to write a little thingy others might like it

Qx = number of selections in top row
Qy = number of selections in second row

TempQcost = 0
QCost = 0

For QCalc = 1 To Qx

TempQcost = 1 * Qy - 1
QCost = QCost + TempQcost
Qy = Qy - 1

Next QCalc

That is it, once the calculation comes out of the loop the Quinella (QCost) is calculated correctly I think.

I also feel quite smart again :)

Michal