10. marts 2008 - 22:20
Der er
5 kommentarer og 1 løsning
regne reslutat sammen og give points virker ikke
jeg forsøger at lave et point system men det virker ikke, hvad gør jeg galt ?? h = hjemmehold o = udehold //leagge points samme pr. runde $map1h = $m1r1h + $m1r2h; $map1o = $m1r1o + $m1r2o; $map2h = $m2r1h + $m2r2h; $map2o = $m2r1o + $m2r2o; $totalh = $map1h + $map2h; $totalo = $map1o + $map2o; //point runde 1 if($map1h < $map1o){ $p1='0'; $p2='1'; } if($map1h > $map1o){ $p1='1'; $p2='0'; } if($map1h == $map1o){ $p1='0'; $p2='0';} //point runde 2 if($map2h < $map2o){ $p3='0'; $p4='1'; } if($map2h > $map2o){ $p3='1'; $p4='0'; } if($map2h == $map2o){ $p3='0'; $p4='0'; } //point total score if($totalh < $totalo){ $p5='0'; $p6='1'; } if($totalh > $totalo){ $p5='1'; $p6='0'; } if($totalh == $totalo){ $p5='0'; $p6='0'; } $totalpointh = $p1 + $p3 + $p5; $totalpointo = $p2 + $p4 + $p4;
Annonceindlæg fra Academic Work Denmark A/S
10. marts 2008 - 22:41
#3
har prøvet at ændre det til dette med den bliver ved med at gi point 2 - 2 og jeg indtaster map1r1h 132 - 0 m1r1o map1r2h 0 - 25 m1r2o map2r1h 20 - 0 m2r1o map2r2 h0 - 68 m2r2o //leagge points samme pr. runde $map1h = $m1r1h + $m1r2h; $map1o = $m1r1o + $m1r2o; $map2h = $m2r1h + $m2r2h; $map2o = $m2r1o + $m2r2o; $totalh = $map1h + $map2h; $totalo = $map1o + $map2o; //point runde 1 if($map1h < $map1o){ $p1=0; $p2=1; } if($map1h > $map1o){ $p1=1; $p2=0; } if($map1h == $map1o){ $p1=0; $p2=0; } //point runde 2 if($map2h < $map2o){ $p3=0; $p4=1; } if($map2h > $map2o){ $p3=1; $p4=0; } if($map2h == $map2o){ $p3=0; $p4=0; } //point total score if($totalh < $totalo){ $p5=0; $p6=1; } if($totalh > $totalo){ $p5=1; $p6=0; } if($totalh == $totalo){ $p5=0; $p6=0; } $totalpointh = $p1 + $p3 + $p5; $totalpointo = $p2 + $p4 + $p4; //hvis draw lige med 0 - 0 if($totalpointh=='0'&&$totalpointo=='0'){ $pt1 =1; $pt2 =1; }else{ $pt1 = $totalpointh; $pt2 = $totalpointo; }
10. marts 2008 - 22:59
#4
Jeg har lige omskrevet din kode en smule for at gøre den mere læselig. Men jeg kan altså ikke lige gennemskue hvad det du skriver her: map1r1h 132 - 0 m1r1o map1r2h 0 - 25 m1r2o map2r1h 20 - 0 m2r1o map2r2 h0 - 68 m2r2o ... har med resten af koden at gøre? //leagge points samme pr. runde $map1h = $m1r1h + $m1r2h; $map1o = $m1r1o + $m1r2o; $map2h = $m2r1h + $m2r2h; $map2o = $m2r1o + $m2r2o; $totalh = $map1h + $map2h; $totalo = $map1o + $map2o; //point runde 1 if ($map1h < $map1o) { $p1 = 0; $p2 = 1; } if ($map1h > $map1o) { $p1 = 1; $p2 = 0; } if ($map1h == $map1o) { $p1 = 0; $p2 = 0; } //point runde 2 if ($map2h < $map2o) { $p3 = 0; $p4 = 1; } if ($map2h > $map2o) { $p3 = 1; $p4 = 0; } if ($map2h == $map2o) { $p3 = 0; $p4 = 0; } //point total score if ($totalh < $totalo) { $p5 = 0; $p6 = 1; } if ($totalh > $totalo) { $p5 = 1; $p6 = 0; } if ($totalh == $totalo) { $p5 = 0; $p6 = 0; } $totalpointh = $p1 + $p3 + $p5; $totalpointo = $p2 + $p4 + $p4; //hvis draw lige med 0 - 0 if ($totalpointh == 0 && $totalpointo == 0) { $pt1 = 1; $pt2 = 1; } else { $pt1 = $totalpointh; $pt2 = $totalpointo; }