Mercurial > hg > batmud > misc
changeset 307:d6b1b38cbb30 misc
Improve statistics calculation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 29 Dec 2015 05:47:14 +0200 |
parents | 1a6f435a1e4d |
children | 809e2a1c64eb |
files | materials/info.php |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/materials/info.php Tue Dec 29 05:46:54 2015 +0200 +++ b/materials/info.php Tue Dec 29 05:47:14 2015 +0200 @@ -279,7 +279,9 @@ $currTable[$to] = $tmp; } if (count($str) > 0) + { echo "<p>Swapped rows: ".implode(", ", $str)."</p>\n"; + } } @@ -297,6 +299,7 @@ $researched = 0; $researchValue = 0; + $total = 0; foreach ($currTable as $mat1) { @@ -340,6 +343,7 @@ } else echo "<td class=\"nohits\" title=\"Not researched\">?</td>"; + $total++; } else { @@ -349,14 +353,21 @@ echo "</tr>\n"; } - $mats = count($currTable); - $total = $mats * $mats - $mats; + // + // Calculate some statistics + // + $total /= 2; + $researched /= 2; + $researchValue /= $total * 12.0; + if ($researchValue > 1.0) + $researchValue = 1.0; - printf("</table>\n". + printf( + "</table>\n". "<div><b>%1.2f%%</b> (%d / %d) of combinations researched. ". "Estimating <b>%1.2f%%</b> overall accuracy.</div>\n", ($researched * 100.0) / $total, $researched, $total, - ($researchValue * 100.0) / ($total * 10.0)); + $researchValue * 100.0); } cmPrintPageFooter();