elo-ranking-bereken

Gesponsorde koppelingen

PHP script bestanden

  1. elo-ranking-bereken

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if(!empty($_POST['score1']) && !empty($_POST['score2']) && !empty($_POST['rating1'])
&&!
empty($_POST['rating2'])){
if($_POST['score1'] != $_POST['score2']){
if($_POST['score1'] > $_POST['score2']){
$out = 120 - round(1/(1+ pow(10,(($_POST['rating2'] - $_POST['rating1'])/400)))*120);
$rating3 = $_POST['rating1'] + $out;
$rating4 = $_POST['rating2'] - $out;
}
else{
$out = 120 - round(1/(1+ pow(10,(($_POST['rating1'] - $_POST['rating2'])/400)))*120);
$rating3 = $_POST['rating1'] - $out;
$rating4 = $_POST['rating2'] + $out;
}
}
else{
if($_POST['rating1'] == $_POST['rating2']){
$rating3 = $_POST['rating1'];
$rating4 = $_POST['rating2'];
}
else{
if($_POST['rating1'] > $_POST['rating2']){
$out = 120 - round(1/(1+ pow(10,(($_POST['rating1'] - $_POST['rating2'])/400)))*120);
$out1 = 120 - round(1/(1+ pow(10,(($_POST['rating2'] - $_POST['rating1'])/400)))*120);
$out = $out - $out1;
$rating3 = $_POST['rating1'] - $out;
$rating4 = $_POST['rating2'] + $out;
}
else{
$out = 120 - round(1/(1+ pow(10,(($_POST['rating2'] - $_POST['rating1'])/400)))*120);
$out1 = 120 - round(1/(1+ pow(10,(($_POST['rating1'] - $_POST['rating2'])/400)))*120);
$out = $out - $out1;
$rating3 = $_POST['rating1'] + $out;
$rating4 = $_POST['rating2'] - $out;
}
}
}
}

echo "<form action='".$_SERVER['phpself']."' method='post'>
<table class='elo'><tr ><td>&nbsp;</td><td>Clan 1/Player 1</td><td>Clan 2/Player2</td></tr>
<tr><td>Points:</td><td><input type='text' size='5'name='rating1' value='"
.$_POST['rating1']."' /></td><td><input type='text' name='rating2'size='5' value='".$_POST['rating2']."' /></td></tr>
<tr><td>Score</td><td><input type='text' name='score1' size='5'value='"
.$_POST['score1']."' /></td>
<td><input type='text' name='score2'size='5' value='"
.$_POST['score2']."' /></td></tr>";
if(!empty($rating3)){
$points1 = $rating3 - $_POST['rating1'];
$points2 = $rating4 - $_POST['rating2'];
if($points1 > 0){
$points1 = "+".$points1;
}

if($points2 > 0){
$points2 = "+".$points2;
}

echo "<tr><td>Points (+/-)</td><td>".$points1."</td><td>".$points2."</td></td></tr>
<tr><td>New ranking</td><td><input type='text'size='5' name='' value='"
.$rating3."' /></td><td><input type='text' name='' size='5'value='".$rating4."' /></td></tr>";
}

echo "<tr><td>&nbsp;</td><td colspan='2'><input type='submit' value='check new ranking' /></td></tr>
</table>"
;
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.