From a54f498a0268523f29acd8e8fa7b70bf35d0ea6f Mon Sep 17 00:00:00 2001 From: Eliah REBSTOCK <eliah.rebstock@ensiie.fr> Date: Mon, 4 Apr 2016 16:26:26 +0200 Subject: [PATCH] ajout de somme dans le test du classement ELO --- ELO_function.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ELO_function.php b/ELO_function.php index f0cb376..2e75229 100644 --- a/ELO_function.php +++ b/ELO_function.php @@ -70,7 +70,7 @@ function ELO($scores_actuel, $scores_obtenus, $K, $D) } /* Test */ -print("<html><body><table><th>Itération</th><th>Joueur 1</th><th>Joueur 2</th><th>Joueur 3</th><th>Joueur 4</th><th>Joueur 5</th></tr>"); +print("<html><body><table><th>Itération</th><th>Joueur 1</th><th>Joueur 2</th><th>Joueur 3</th><th>Joueur 4</th><th>Joueur 5</th><th>Somme</th></tr>"); $sa = array(-2,-1,0,1,2); $DS = array(1000,1000,1000,1000,1000); @@ -78,8 +78,11 @@ print("<tr><td>0</td>"); foreach ($DS as $value) { print("<td>$value</td>"); } -print("</tr>"); -$j = 1; +$p = array_sum($DS); +print("<td>$p</td></tr>"); + +for($j=1;$j<20;$j++){ + $sa = array(-2,-1,0,1,2); $res = ELO($DS, $sa, 32, 400); print("<tr><td>$j</td>"); for ($i=0;$i<count($DS);$i++) { @@ -88,8 +91,9 @@ $j = 1; $k2 = $res[$i]; print("<td>$k1 ($k2)</td>"); } - print("</tr>"); -$j = 2; + $p = array_sum($DS); + print("<td>$p</td></tr>"); +$j++; $sa = array(2,1,0,-1,-2); $res = ELO($DS, $sa, 32, 400); @@ -100,8 +104,10 @@ for ($i=0;$i<count($DS);$i++) { $k2 = $res[$i]; print("<td>$k1 ($k2)</td>"); } -print("</tr>"); +$p = array_sum($DS); +print("<td>$p</td></tr>"); +} print("</table></body></html>"); -- GitLab