Mercurial > hg > batmud > misc
annotate materials/info.php @ 325:b65e0d6efe9d misc
Add copyright blurb.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 31 Dec 2015 02:59:54 +0200 |
parents | 1f3fd2d0831b |
children | 03963c456ed8 |
rev | line source |
---|---|
250 | 1 <? |
325 | 2 // |
3 // BatMUD material alloy combo and material info viewer | |
4 // (C) Copyright 2009 - 2015 Matti 'ccr' Hämäläinen <ccr@tnsp.org> | |
5 // | |
316 | 6 require "mgeneric.inc.php"; |
7 require "materials.inc.php"; | |
8 require "alloys.inc.php"; | |
9 | |
250 | 10 $pageTitle = "Pupunen BatMUD Alloy Browser"; |
11 $pageIndex = "info.php"; | |
316 | 12 |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
13 |
316 | 14 $contributors = |
15 [ | |
16 "Hair", "Malacoda", "Kiomet", "Aegenor", "Gileon", "Corto", | |
313 | 17 ]; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
18 |
250 | 19 |
316 | 20 $matTypeTable = |
21 [ | |
22 0 => ["Organic + cloth (sewing)" , 0, 1], | |
23 1 => ["Wood + bone (carpentry)" , 5, 3], | |
24 2 => ["Metal + alloy (blacksmithing)" , 4, 7], | |
25 3 => ["Stone (masonry)" , 6, -1], | |
26 4 => ["Gem (gemcutting)" , 10, -1], | |
27 5 => ["Inorganic (sculpture)" , 8, -1], | |
28 6 => ["Glass (glassblowing)" , 9, -1], | |
29 | |
30 7 => ["Organic" , 0, -1], | |
31 8 => ["Wood" , 5, -1], | |
32 9 => ["Metal" , 4, -1], | |
33 | |
34 10 => ["Cloth" , -1, 1], | |
35 11 => ["Bone" , -1, 3], | |
36 12 => ["Alloy" , -1, 7], | |
37 ]; | |
38 | |
39 | |
40 $matReliability = | |
41 [ | |
322
1f3fd2d0831b
Adjust threshold values for alloy tests.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
42 [ 1, 2, "1-2 tests", "background: #a00; color: white;" ], |
1f3fd2d0831b
Adjust threshold values for alloy tests.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
43 [ 3, 5, "3-5 tests", "background: #750; color: white;" ], |
1f3fd2d0831b
Adjust threshold values for alloy tests.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
44 [ 6, 9, "6-9 tests", "background: #c90; color: black;", "color: black;" ], |
1f3fd2d0831b
Adjust threshold values for alloy tests.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
45 [ 10, 9999, "10 or more", "background: #080; color: white;" ], |
316 | 46 ]; |
250 | 47 |
48 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
49 function stGetMatLink($mat, $title = "", $extra = "") |
250 | 50 { |
51 $tmp = ($title != "") ? " title=\"".chentities($title)."\"" : ""; | |
253
1eca10751695
Improve alloy browser output.
Matti Hamalainen <ccr@tnsp.org>
parents:
250
diff
changeset
|
52 return "<a href=\"/mat/".urlencode($mat)."\"".$tmp.">".chentities($mat)."</a>".$extra; |
250 | 53 } |
54 | |
55 | |
316 | 56 function stGetReliabilityStyle($n) |
250 | 57 { |
316 | 58 global $matReliability; |
59 foreach ($matReliability as $chk) | |
313 | 60 { |
61 if ($n >= $chk[0] && $n <= $chk[1]) | |
62 return " class=\"hits".$chk[0]."to".$chk[1]."\""; | |
63 } | |
64 return ""; | |
250 | 65 } |
66 | |
67 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
68 // |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
69 // Actual main code begins |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
70 // |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
71 $setShowOnly = intval(stGetRequestItem("o", 0, TRUE)); |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
72 |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
73 if (isset($_GET["m"])) |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
74 { |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
75 $setShowMat = strtolower($_GET["m"]); |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
76 $setShowMatName = strtoupper(substr($setShowMat,0,1)).substr($setShowMat, 1); |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
77 } |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
78 |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
79 $setSwapRows = (isset($_GET["swap"]) && is_array($_GET["swap"])) ? $_GET["swap"] : array(); |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
80 |
313 | 81 $extraCSS = []; |
82 $extraInfo = []; | |
316 | 83 foreach ($matReliability as $chk) |
313 | 84 { |
85 $tmps = "hits".$chk[0]."to".$chk[1]; | |
86 $extraCSS[] = " td.".$tmps.", .".$tmps." { ".$chk[3]." }"; | |
87 if (isset($chk[4])) | |
88 $extraCSS[] = " td.".$tmps." a { ".$chk[4]." }"; | |
89 | |
90 $extraInfo[] = "<span class=\"hits".$chk[0]."to".$chk[1]."\"><b>".$chk[2]."</b></span>"; | |
91 } | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
92 |
250 | 93 cmPrintPageHeader($pageTitle, " |
94 <meta name=\"robots\" content=\"nofollow\" /> | |
95 <style type=\"text/css\"> | |
96 span.alternate { color: red; font-weight: bold; } | |
313 | 97 ".implode("\n", $extraCSS)." |
250 | 98 td.nohits, .nohits { background: black; } |
99 td.impossible { background: black; color: #f00; text-align: center; } | |
100 </style> | |
101 "); | |
310 | 102 |
313 | 103 echo |
104 "<h1>".$pageTitle."</h1>\n". | |
105 "<form action=\"".$pageIndex."\" method=\"get\">\n". | |
106 "<table class=\"optionsTable\" width=\"100%\">\n". | |
107 " <tr>\n". | |
108 " <th width=\"25%\">Show type</th>\n". | |
109 " <td rowspan=\"3\" class=\"infobox\">\n". | |
110 " [<a href=\"".$pageIndex."\">Reset/Clear</a>] [<a href=\"index.php\">Material browser</a>]\n". | |
111 " <br />\n". | |
112 " <ul>\n". | |
113 " <li><b>Also available in <a href=\"alloys.txt\">ASCII plaintext format</a>.</b></li>\n". | |
114 " <li><b><a href=\"instructions.php\">Read this</a> for instructions on how you can collect and submit your own alloy research data.</b></li>\n". | |
115 " <li>Only 2-material alloys are supported by this browser.</li>\n". | |
116 " <li>There may be errors, and lots of combinations are not researched yet.</li>\n". | |
314 | 117 " <li>The cell colour reflects how \"reliable\" the information is: ".implode(", ", $extraInfo).".</li>\n"; |
313 | 118 |
316 | 119 if (isset($contributors) && count($contributors) > 0) |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
120 { |
313 | 121 $tmp = []; |
316 | 122 foreach ($contributors as $key) |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
123 $tmp[] = "<b>".$key."</b>"; |
313 | 124 echo " <li>Thanks to the following people for providing alloying data: ".join(", ", $tmp).".</li>\n"; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
125 } |
310 | 126 |
127 echo | |
314 | 128 " </ul>\n". |
310 | 129 " </td>\n". |
130 " </tr>\n". | |
131 " <tr>\n". | |
132 " <td class=\"icenter\">\n". | |
133 " <select name=\"o\">\n"; | |
134 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
135 foreach ($matTypeTable as $key => $value) |
250 | 136 { |
255 | 137 $n = 0; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
138 foreach ($matDataTable as $name => $data) |
255 | 139 { |
140 if ($data[14] == $value[1] || $data[14] == $value[2]) | |
141 $n++; | |
142 } | |
143 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
144 $matTypeTable[$key][] = $n; |
255 | 145 |
146 printf( | |
147 " <option value=\"%s\"%s>%-30s [%d]</option>\n", | |
148 $key, | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
149 ($setShowOnly == $key ? " selected=\"selected\"" : ""), |
255 | 150 chentities($value[0]), $n); |
250 | 151 } |
152 | |
310 | 153 echo |
154 " </select>\n". | |
155 " </td>\n". | |
156 " </tr>\n". | |
157 " <tr>\n". | |
158 " <td class=\"icenter\"><input type=\"submit\" value=\" Filter \" class=\"isubmit\" /></td>\n". | |
159 " </tr>\n". | |
160 "</table>\n". | |
161 "</form>\n"; | |
162 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
163 if (isset($setShowMat)) |
250 | 164 { |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
165 if (!isset($matDataTable[$setShowMat])) |
250 | 166 { |
167 echo | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
168 "<h2>Error! No such material '".$setShowMatName."'</h2>\n". |
250 | 169 "<p>Material is not known. Check spelling.</p>\n"; |
170 } | |
171 else | |
172 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
173 echo "<h2>".$setShowMatName."</h2>\n". |
250 | 174 "<table width=\"95%\">\n". |
175 "<tr>"; | |
176 | |
177 $n = 0; | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
178 foreach ($matDataTable[$setShowMat] as $key => $val) |
250 | 179 { |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
180 echo "<th>".chentities($matTransNames[$key + 1])."</th><td>"; |
250 | 181 if (is_array($val)) |
182 { | |
313 | 183 $tmp = []; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
184 foreach ($val as $lode) |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
185 $tmp[] = chentities($matTransTable[$key][$lode]); |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
186 echo join(", ", $tmp); |
250 | 187 } |
188 else | |
189 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
190 echo chentities($matTransTable[$key][$val]); |
250 | 191 } |
192 echo "</td>"; | |
193 if ($n++ >= 2) { echo "</tr>\n<tr>"; $n = 0; } | |
194 } | |
195 echo "</tr>\n</table>\n"; | |
196 | |
197 echo "<h3>Alloy combinations</h3>\n"; | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
198 if (isset($alloyRevTable[$setShowMat])) |
250 | 199 { |
200 echo "<ul>\n"; | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
201 foreach ($alloyRevTable[$setShowMat] as $mat => $value) |
250 | 202 { |
313 | 203 $tmp = []; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
204 foreach ($value as $qkey => $qval) |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
205 $tmp[] = stGetMatLink($qkey); |
250 | 206 |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
207 echo |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
208 " <li>".stGetMatLink($mat)." <b>+</b> ".join(" <b>|</b> ", $tmp). |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
209 "<b> = ".chentities($setShowMat)."</b></li>\n"; |
250 | 210 } |
291 | 211 echo |
212 "</ul>\n". | |
213 "<pre>\n". | |
214 "Syntax: <b>+</b> is AND, <b>|</b> is OR, e.g.:\n". | |
215 "<b>A + B = C</b> means A alloyed with B produces C.\n". | |
216 "<b>A + B | C = D</b> means A alloyed with B <b>or</b> C produces D.\n". | |
217 "</pre>\n"; | |
250 | 218 } |
219 else | |
220 { | |
221 echo "<p>No known alloy combinations.</p>\n"; | |
222 } | |
223 | |
224 /* | |
313 | 225 $typeMats = []; |
309 | 226 foreach ($matDataTable as $name => $data) |
227 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
228 if ($data[14] == $matDataTable[$setShowMat][14] && $name != $setShowMat) |
250 | 229 $typeMats[] = $name; |
230 } | |
231 | |
309 | 232 echo "<p>Full mix: "; |
250 | 233 if (list($a, $b) = each($typeMats)) |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
234 echo stGetMatLink($b); |
250 | 235 |
236 while (list($a, $b) = each($typeMats)) | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
237 echo " <b>+</b> ".stGetMatLink($b); |
309 | 238 echo "</p>\n"; |
250 | 239 */ |
240 | |
241 echo "<h3>Mixtable</h3>\n"; | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
242 if (count($alloyTable[$setShowMat]) > 0) |
250 | 243 { |
244 echo | |
309 | 245 "<table class=\"matTable\">". |
246 " <tr>\n". | |
247 " <th>+</th>\n"; | |
248 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
249 foreach ($alloyTable[$setShowMat] as $key => $value) |
250 | 250 { |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
251 echo "<th>".stGetMatLink($key)."</th>\n"; |
250 | 252 } |
309 | 253 |
254 echo | |
255 " </tr>\n". | |
256 " <tr><th>".chentities($setShowMat)."</th>"; | |
257 | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
258 foreach ($alloyTable[$setShowMat] as $key => $value) |
250 | 259 { |
309 | 260 if (list($a, $b) = each($value)) |
261 { | |
316 | 262 echo "<td ".stGetReliabilityStyle($b).">".stGetMatLink($a)."</td>"; |
309 | 263 } |
250 | 264 } |
265 echo "</tr></table>\n"; | |
266 } | |
267 else | |
268 { | |
269 echo "<p>No mixtable entries.</p>\n"; | |
270 } | |
271 } | |
272 } | |
273 else | |
274 { | |
275 /* | |
276 * Print alloy table for given material type | |
277 */ | |
278 // Filter table from maintable matching desired material type(s) | |
313 | 279 $currTable = []; |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
280 foreach ($matDataTable as $name => $data) |
250 | 281 { |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
282 if ($data[14] == $matTypeTable[$setShowOnly][1] || |
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
283 $data[14] == $matTypeTable[$setShowOnly][2]) |
250 | 284 $currTable[] = $name; |
285 } | |
286 | |
287 // Swap desired rows | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
288 if (count($setSwapRows) > 0) |
250 | 289 { |
313 | 290 $str = []; |
250 | 291 $nkeys = count($currTable); |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
292 foreach ($setSwapRows as $from => $to) |
250 | 293 if ($from >= 0 && $from < $nkeys && $to >= 0 && $to < $nkeys && $to != $from) |
294 { | |
295 $str[] = $from." <=> ".$to; | |
296 | |
297 $tmp = $currTable[$from]; | |
298 $currTable[$from] = $currTable[$to]; | |
299 $currTable[$to] = $tmp; | |
300 } | |
309 | 301 |
250 | 302 if (count($str) > 0) |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
303 { |
250 | 304 echo "<p>Swapped rows: ".implode(", ", $str)."</p>\n"; |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
305 } |
250 | 306 } |
307 | |
308 | |
309 // Print out the table | |
310 echo | |
311 "<table class=\"alloyTable\">". | |
312 " <tr>\n". | |
313 " <th>-</th>\n"; | |
314 | |
315 foreach ($currTable as $name) | |
316 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
317 echo " <th>".stGetMatLink($name)."</th>\n"; |
250 | 318 } |
319 echo " </tr>\n"; | |
320 | |
255 | 321 $researched = 0; |
322 $researchValue = 0; | |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
323 $total = 0; |
255 | 324 |
250 | 325 foreach ($currTable as $mat1) |
326 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
327 echo " <tr><th>".stGetMatLink($mat1)."</th>"; |
250 | 328 foreach ($currTable as $mat2) |
329 { | |
330 // Is the combo possible? | |
331 if ($mat1 != $mat2) | |
332 { | |
333 // Check for combination result | |
334 if (isset($alloyTable[$mat1][$mat2])) | |
335 $tmp = $alloyTable[$mat1][$mat2]; | |
336 else | |
337 if (isset($alloyTable[$mat2][$mat1])) | |
338 $tmp = $alloyTable[$mat2][$mat1]; | |
339 else | |
340 unset($tmp); | |
341 | |
342 if (isset($tmp)) | |
343 { | |
344 arsort($tmp); | |
345 $value = 0; | |
346 foreach ($tmp as $a => $b) | |
347 $value += $b; | |
348 | |
255 | 349 $researched++; |
350 $researchValue += $value; | |
351 | |
313 | 352 $slist = []; |
250 | 353 foreach ($tmp as $a => $b) |
354 { | |
296
8724b9de70bf
Variable renames, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
292
diff
changeset
|
355 $slist[] = stGetMatLink($a, |
250 | 356 $b." successful alloys (".$mat1." + ".$mat2." = ".$a.")". |
255 | 357 (count($tmp) > 1 ? " [UNSTABLE]" : "") |
358 ); | |
359 // , " <sup>".$b."</sup>"); | |
250 | 360 } |
361 echo | |
316 | 362 "<td".stGetReliabilityStyle($value, count($tmp) > 1 ? " mitalic" : "").">". |
250 | 363 join(" <span class=\"alternate\">/</span> ", $slist)."</td>"; |
364 } | |
365 else | |
366 echo "<td class=\"nohits\" title=\"Not researched\">?</td>"; | |
309 | 367 |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
368 $total++; |
250 | 369 } |
370 else | |
371 { | |
372 echo "<td class=\"impossible\" title=\"Impossible combination\">-</td>"; | |
373 } | |
374 } | |
375 echo "</tr>\n"; | |
376 } | |
255 | 377 |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
378 // |
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
379 // Calculate some statistics |
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
380 // |
309 | 381 $researchValue /= $researched * 15.0; |
382 if ($researchValue > 1.0) | |
383 $researchValue = 1.0; | |
384 | |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
385 $total /= 2; |
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
386 $researched /= 2; |
255 | 387 |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
388 printf( |
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
389 "</table>\n". |
255 | 390 "<div><b>%1.2f%%</b> (%d / %d) of combinations researched. ". |
391 "Estimating <b>%1.2f%%</b> overall accuracy.</div>\n", | |
392 ($researched * 100.0) / $total, $researched, $total, | |
307
d6b1b38cbb30
Improve statistics calculation.
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
393 $researchValue * 100.0); |
250 | 394 } |
395 | |
396 cmPrintPageFooter(); | |
397 ?> |