[go: up one dir, main page]

Menu

[r1]: / a.php  Maximize  Restore  History

Download this file

204 lines (186 with data), 7.2 kB

  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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
function eloW($eloW,$eloB,$res) {
}
$eloW = eloW($eloW,$eloB,$res);
$eloB = eloB($eloW,$eloB,$res);
// riempimento array elo avversari
function PuntiAvv() {
Punti[1] = document.FormElo.Avv01.value;
Punti[2] = document.FormElo.Avv02.value;
Punti[3] = document.FormElo.Avv03.value;
Punti[4] = document.FormElo.Avv04.value;
Punti[5] = document.FormElo.Avv05.value;
Punti[6] = document.FormElo.Avv06.value;
Punti[7] = document.FormElo.Avv07.value;
Punti[8] = document.FormElo.Avv08.value;
Punti[9] = document.FormElo.Avv09.value;
Punti[10] = document.FormElo.Avv10.value;
Punti[11] = document.FormElo.Avv11.value;
}
// calcolo differenze tra elo giocatore ed elo avversari
function Differenze() {
Diff[1] = 0
document.FormElo.Diff01.value = "";
if (Punti[1] > 0) { Diff[1] = document.FormElo.TuoElo.value - Punti[1];
document.FormElo.Diff01.value = Diff[1]; }
Diff[2] = 0
document.FormElo.Diff02.value = "";
if (Punti[2] > 0) { Diff[2] = document.FormElo.TuoElo.value - Punti[2];
document.FormElo.Diff02.value = Diff[2]; }
Diff[3] = 0
document.FormElo.Diff03.value = "";
if (Punti[3] > 0) { Diff[3] = document.FormElo.TuoElo.value - Punti[3];
document.FormElo.Diff03.value = Diff[3]; }
Diff[4] = 0
document.FormElo.Diff04.value = "";
if (Punti[4] > 0) { Diff[4] = document.FormElo.TuoElo.value - Punti[4];
document.FormElo.Diff04.value = Diff[4]; }
Diff[5] = 0
document.FormElo.Diff05.value = "";
if (Punti[5] > 0) { Diff[5] = document.FormElo.TuoElo.value - Punti[5];
document.FormElo.Diff05.value = Diff[5]; }
Diff[6] = 0
document.FormElo.Diff06.value = "";
if (Punti[6] > 0) { Diff[6] = document.FormElo.TuoElo.value - Punti[6];
document.FormElo.Diff06.value = Diff[6]; }
Diff[7] = 0
document.FormElo.Diff07.value = "";
if (Punti[7] > 0) { Diff[7] = document.FormElo.TuoElo.value - Punti[7];
document.FormElo.Diff07.value = Diff[7]; }
Diff[8] = 0
document.FormElo.Diff08.value = "";
if (Punti[8] > 0) { Diff[8] = document.FormElo.TuoElo.value - Punti[8];
document.FormElo.Diff08.value = Diff[8]; }
Diff[9] = 0
document.FormElo.Diff09.value = "";
if (Punti[9] > 0) { Diff[9] = document.FormElo.TuoElo.value - Punti[9];
document.FormElo.Diff09.value = Diff[9]; }
Diff[10] = 0
document.FormElo.Diff10.value = "";
if (Punti[10] > 0) { Diff[10] = document.FormElo.TuoElo.value - Punti[10];
document.FormElo.Diff10.value = Diff[10]; }
Diff[11] = 0
document.FormElo.Diff11.value = "";
if (Punti[11] > 0) { Diff[11] = document.FormElo.TuoElo.value - Punti[11];
document.FormElo.Diff11.value = Diff[11]; }
}
// riempimento array differenze e percentuali attese
function Attese() {
AttDiff[1] = 0; AttDiff[2] = 4; AttDiff[3] = 11; AttDiff[4] = 18; AttDiff[5] = 26;
AttDiff[6] = 33; AttDiff[7] = 40; AttDiff[8] = 47; AttDiff[9] = 54; AttDiff[10] = 62;
AttDiff[11] = 69; AttDiff[12] = 77; AttDiff[13] = 84; AttDiff[14] = 92; AttDiff[15] = 99;
AttDiff[16] = 107; AttDiff[17] = 114; AttDiff[18] = 122; AttDiff[19] = 130; AttDiff[20] = 138;
AttDiff[21] = 146; AttDiff[22] = 154; AttDiff[23] = 163; AttDiff[24] = 171; AttDiff[25] = 180;
AttDiff[26] = 189; AttDiff[27] = 198; AttDiff[28] = 207; AttDiff[29] = 216; AttDiff[30] = 226;
AttDiff[31] = 236; AttDiff[32] = 246; AttDiff[33] = 257; AttDiff[34] = 268; AttDiff[35] = 279;
AttDiff[36] = 291; AttDiff[37] = 303; AttDiff[38] = 316; AttDiff[39] = 329; AttDiff[40] = 345;
AttDiff[41] = 358; AttDiff[42] = 375; AttDiff[43] = 392; AttDiff[44] = 412; AttDiff[45] = 433;
AttDiff[46] = 457; AttDiff[47] = 485; AttDiff[48] = 518; AttDiff[49] = 560; AttDiff[50] = 620;
AttDiff[51] = 736;
AttPerc[1] = 50; AttPerc[2] = 51; AttPerc[3] = 52; AttPerc[4] = 53; AttPerc[5] = 54;
AttPerc[6] = 55; AttPerc[7] = 56; AttPerc[8] = 57; AttPerc[9] = 58; AttPerc[10] = 59;
AttPerc[11] = 60; AttPerc[12] = 61; AttPerc[13] = 62; AttPerc[14] = 63; AttPerc[15] = 64;
AttPerc[16] = 65; AttPerc[17] = 66; AttPerc[18] = 67; AttPerc[19] = 68; AttPerc[20] = 69;
AttPerc[21] = 70; AttPerc[22] = 71; AttPerc[23] = 72; AttPerc[24] = 73; AttPerc[25] = 74;
AttPerc[26] = 75; AttPerc[27] = 76; AttPerc[28] = 77; AttPerc[29] = 78; AttPerc[30] = 79;
AttPerc[31] = 80; AttPerc[32] = 81; AttPerc[33] = 82; AttPerc[34] = 83; AttPerc[35] = 84;
AttPerc[36] = 85; AttPerc[37] = 86; AttPerc[38] = 87; AttPerc[39] = 88; AttPerc[40] = 89;
AttPerc[41] = 89; AttPerc[42] = 89; AttPerc[43] = 89; AttPerc[44] = 89; AttPerc[45] = 89;
AttPerc[46] = 89; AttPerc[47] = 89; AttPerc[48] = 89; AttPerc[49] = 89; AttPerc[50] = 89;
AttPerc[51] = 89;
}
// calcolo percentuale attesa avversario per avversario
function CalcAtt() {
for (x = 1; x <= 11; x++) {
Att[x] = "";
if (Punti[x] > 0) {
CalcAtt2(Diff[x])
}
}
document.FormElo.PerAtt01.value = Att[1];
document.FormElo.PerAtt02.value = Att[2];
document.FormElo.PerAtt03.value = Att[3];
document.FormElo.PerAtt04.value = Att[4];
document.FormElo.PerAtt05.value = Att[5];
document.FormElo.PerAtt06.value = Att[6];
document.FormElo.PerAtt07.value = Att[7];
document.FormElo.PerAtt08.value = Att[8];
document.FormElo.PerAtt09.value = Att[9];
document.FormElo.PerAtt10.value = Att[10];
document.FormElo.PerAtt11.value = Att[11];
}
// ricerca percentuale attesa su array
function CalcAtt2(Differenza) {
for (y = 1; y <= 51; y++) {
if (Math.abs(Diff[x]) >= AttDiff[y]) {
percent = AttPerc[y];
if (Diff[x] >= 0) {
Att[x] = percent;
}
else {
Att[x] = 100 - percent;
}
}
}
}
// somma percentuali attese
function Somma() {
somma = 0
for (x = 1; x <= 11; x++) {
somma = somma + Math.floor(Att[x])
}
document.FormElo.SommaPer.value = somma
}
// calcolo punti attesi
function PuntiAttesi() {
somma = somma/100
document.FormElo.PunAtt.value = somma
}
// arrotondamento punti attesi
function PuntiAttesiArr() {
somma = Math.floor((somma + 0.04) * 10) / 10
document.FormElo.PunAttArr.value = somma
}
// calcolo differenza in punti
function Differenza() {
val1 = Math.floor((document.FormElo.PuntiFatti.value) * 10)
val2 = Math.floor((document.FormElo.PunAttArr.value) * 10)
valore = (eval(val1) - eval(val2)) / 10
document.FormElo.Diffe.value = valore
}
// calcolo differenza in punti Elo
function DifferenzaElo() {
document.FormElo.DiffeElo.value = Math.floor(valore * document.FormElo.K.value)
}
// calcolo nuovo elo
function NewElo() {
document.FormElo.VecchioElo.value = document.FormElo.TuoElo.value;
val1 = document.FormElo.TuoElo.value;
val2 = document.FormElo.DiffeElo.value;
document.FormElo.NuovoElo.value = eval(val1) + eval(val2)
}
// driver di calcolo
function Calcola() {
val1 = Math.floor(document.FormElo.TuoElo.value)
if (val1 > 0) {
if (dim == 0) {
Punti = new MakeArray(11);
Diff = new MakeArray(11);
AttDiff = new MakeArray(51);
AttPerc = new MakeArray(51);
Att = new MakeArray(11);
dim = 1;
}
PuntiAvv();
Differenze();
Attese();
CalcAtt();
Somma();
PuntiAttesi();
PuntiAttesiArr();
Differenza();
DifferenzaElo();
NewElo();
}
}
// -->