Posts: 805
Name: Will Craig
Location: Cheltenham, Gloucestershire, UK
|
I have started myself a little project, a Deal Or No Deal PHP game.
Below is a list of variables i need to use to work out average, i will then use the average to work out bankers offer:
PHP Code:
$row = mysql_fetch_row($result);
$box1 = "$row[1]";
$box2 = "$row[2]";
$box3 = "$row[13]";
$box4 = "$row[14]";
$box5 = "$row[15]";
$box6 = "$row[16]";
$box7 = "$row[17]";
$box8 = "$row[18]";
$box9 = "$row[19]";
$box10 = "$row[3]";
$box11 = "$row[4]";
$box12 = "$row[5]";
$box13 = "$row[6]";
$box14 = "$row[7]";
$box15 = "$row[8]";
$box16 = "$row[9]";
$box17 = "$row[10]";
$box18 = "$row[11]";
$box19 = "$row[12]";
$box20 = "$row[20]";
$box21 = "$row[21]";
$box22 = "$row[22]";
$picked1 = "$row[23]";
$picked2 = "$row[24]";
$picked3 = "$row[25]";
$picked4 = "$row[26]";
$picked5 = "$row[27]";
$picked6 = "$row[28]";
$picked7 = "$row[29]";
$picked8 = "$row[30]";
$picked9 = "$row[31]";
$picked10 = "$row[32]";
$picked11 = "$row[33]";
$picked12 = "$row[34]";
$picked13 = "$row[35]";
$picked14 = "$row[36]";
$picked15 = "$row[37]";
$picked16 = "$row[38]";
$picked17 = "$row[39]";
$picked18 = "$row[40]";
$picked19 = "$row[41]";
$picked20 = "$row[42]";
$picked21 = "$row[43]";
$picked22 = "$row[44]";
$player = "$row[45]";
$onbox = "$row[46]";
$player is the players box number
$box# is the amount of money in that box
When $picked# = 1 then the user has picked that box number.
I will simplify this to 3 boxes:
$box1 = 0.01
$picked1 = 1
$box2 = 0.10
$picked2 = 0
$box3 = 0.50
$picked3 = 0
$player = 3
I want to add up the unpicked (where $picked# = 0) box values ($box#) then divide by the number of unpicked boxes.
|