";
$pixels1=$numberboxes*104*(-1)-20;//if I change the speed I will also have to chnage the 104
$px="px";
$pixels="$pixels1$px";
echo "
";
echo "
";
///$item1 one is the array of weights for how often a particular type of attribute should appear in the FIRST half of the campaign
$item1 = array(
1 => 32,//issues and endorsements
2 => 36,//candidate traits
3 => 10,//party
4 => 11,//horsrace and hoopla
5 => 1,
6 => 10
);
///$item2 one is the array of weights for how often a particular type of attribute should appear in the SECOND half of the campaign
$item2 = array(
1 => 28,//issues and endorsements
2 => 22,//candidate traits
3 => 10,//party
4 => 20,//horsrace and hoopla
5 => 1,
6 => 15
);
function array_rand_weighted($values) {
$r = mt_rand(1, array_sum($values));
foreach ($values as $item => $weight) {
if ($r <= $weight) return $item;
$r -= $weight;
}
}
for ( $counter=$numberboxes; $counter >=1; $counter--){
//$type= array_rand_weighted($items);
if ($counter <=100){
$type= array_rand_weighted($item1);
}
else{
$type= array_rand_weighted($item2);
}
if ($type==1){
$attribute=mt_rand(1,22);
$candidate=mt_rand(1,2);
}
elseif ($type==2){
$attribute=mt_rand(23,28);
$candidate=mt_rand(1,2);
}
elseif ($type==3){
$attribute=29;
$candidate=mt_rand(1,2);
}
elseif ($type==4){
$attribute=mt_rand(31,35);
if (($attribute>=31) && ($attribute<=34)){
$candidate=mt_rand(1,2);
}
else
$candidate=mt_rand(3,16);
}
elseif ($type==5){
$attribute=36;
$candidate=mt_rand(17,18);
}
elseif ($type==6){
$attribute=30;
$candidate=mt_rand(1,2);
}
$query2="SELECT label, pagenumber FROM content WHERE attribute=$attribute AND candidate=$candidate";
$result2=mysql_query($query2);
echo mysql_error();
$row2 = mysql_fetch_array($result2);
$presC="Bill";
$presL="Ryan";
$label=$row2[label];
$pagenumber=$row2[pagenumber];
eval("\$label = \"$label\";");
eval("\$pagenumber = \"$pagenumber\";");
/
//////////////
if ($candidate==1){
$class="pl";}
elseif ($candidate==2){
$class="pc";}
elseif ($candidate > 2){
$class="po";
}
$query3 = "UPDATE pageorder SET $userid='$pagenumber' WHERE number = '$counter'";
$result3 = mysql_query($query3);
echo mysql_error();
$query6 = "UPDATE candidate SET $userid='$candidate' WHERE number = '$counter'";
$result6 = mysql_query($query6);
echo mysql_error();
$query7 = "UPDATE attribute SET $userid='$attribute' WHERE number = '$counter'";
$result7 = mysql_query($query7);
echo mysql_error();
$enter = $counter*$start;
"UPDATE enter SET $userid='$enter' WHERE number = '$counter'";
$query4 = "UPDATE enter SET $userid='$enter' WHERE number = '$counter'";
$result4 = mysql_query($query4);
echo mysql_error();
$pexit=$enter+$lapse;
"UPDATE pexit SET $userid='$pexit' WHERE number = '$counter'";
$query5 = "UPDATE pexit SET $userid='$pexit' WHERE number = '$counter'";
$result5 = mysql_query($query5);
echo mysql_error();
echo "";
echo "";
}
echo "