TOP 10: Porovnání verzí
Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
Řádek 9: | Řádek 9: | ||
:global users 0,0 | :global users 0,0 | ||
:global userDownload 0 | :global userDownload 0 | ||
:global maxDownload 0,0 | :global maxDownload 0,0 | ||
:global top 10 | :global top 10 | ||
:global hArray1 | :global hArray1 | ||
:global hArray2 | :global hArray2 | ||
:global a | :global a | ||
:global b | :global b | ||
:global c | :global c | ||
:global d | :global d | ||
:global hInt | :global hInt | ||
Řádek 39: | Řádek 34: | ||
:local slashPosition [:find $userBytes /]; | :local slashPosition [:find $userBytes /]; | ||
:set userDownload [:pick $userBytes ($slashPosition+1) [:len $userBytes]]; | :set userDownload [:pick $userBytes ($slashPosition+1) [:len $userBytes]]; | ||
:set users ($users + $x) | :set users ($users + $x) | ||
:set maxDownload ($maxDownload + $userDownload) | :set maxDownload ($maxDownload + $userDownload) | ||
:set hArray1 $maxDownload | :set hArray1 $maxDownload | ||
:set hArray2 | :set hArray2 $users | ||
:for i from 0 to=([:len $maxDownload]-2) do={ | :for i from 0 to=([:len $maxDownload]-2) do={ | ||
Řádek 53: | Řádek 45: | ||
:set hArray1 0; | :set hArray1 0; | ||
:set hArray2 0; | :set hArray2 0; | ||
:set a [:pick $maxDownload $i ($i+1)]; | :set a [:pick $maxDownload $i ($i+1)]; | ||
:set b [:pick $maxDownload $j ($j+1)]; | :set b [:pick $maxDownload $j ($j+1)]; | ||
:set c [:pick $ | :set c [:pick $users $i ($i+1)]; | ||
:set d | :set d [:pick $users $j ($j+1)]; | ||
:if ($a<$b | :if ($a<$b) do={ | ||
:set hInt $a; | :set hInt $a; | ||
Řádek 69: | Řádek 58: | ||
:set c $d; | :set c $d; | ||
:set d $hInt; | :set d $hInt; | ||
} | } | ||
:set hArray1 ([:pick $maxDownload 0 $i] + $a); | :set hArray1 ([:pick $maxDownload 0 $i] + $a); | ||
:set hArray2 ([:pick $ | :set hArray2 ([:pick $users 0 $i] + $c); | ||
:if (($i+1)<$j) do={ | :if (($i+1)<$j) do={ | ||
:set hArray1 ($hArray1 + [:pick $maxDownload ($i+1) $j]); | :set hArray1 ($hArray1 + [:pick $maxDownload ($i+1) $j]); | ||
:set hArray2 ($hArray2 | :set hArray2 ($hArray2 + [:pick $users ($i+1) $j]); | ||
} | } | ||
Řádek 89: | Řádek 73: | ||
:set hArray1 ($hArray1 + $b); | :set hArray1 ($hArray1 + $b); | ||
:set hArray2 ($hArray2 + $d); | :set hArray2 ($hArray2 + $d); | ||
:if (($j+1)<[:len $maxDownload]) do={ | :if (($j+1)<[:len $maxDownload]) do={ | ||
:set hArray1 ($hArray1 + [:pick $maxDownload ($j+1) ([:len $maxDownload])]) | :set hArray1 ($hArray1 + [:pick $maxDownload ($j+1) ([:len $maxDownload])]) | ||
:set hArray2 ($hArray2 | :set hArray2 ($hArray2 + [:pick $users ($j+1) ([:len $users])]) | ||
} | } | ||
:set maxDownload $hArray1 | :set maxDownload $hArray1 | ||
:set | :set users $hArray2 | ||
} | } | ||
Řádek 108: | Řádek 89: | ||
:set maxDownload [:pick $maxDownload 0 $top] | :set maxDownload [:pick $maxDownload 0 $top] | ||
:set users [:pick $users 0 $top] | :set users [:pick $users 0 $top] | ||
Verze z 30. 12. 2008, 00:14
Verze 1
:global x 0 :global myParent "wifi" :global badParent "stahovaci" :global userBytes 0/0 :global users 0,0 :global userDownload 0 :global maxDownload 0,0 :global top 10 :global hArray1 :global hArray2 :global a :global b :global c :global d :global hInt /queue simple :foreach i in=[find parent=$badParent] do={ set $i parent=$myParent; } :foreach i in=[find] do={ :if ([get $i parent]=$myParent) do={ :set userBytes [get $i bytes]; :local slashPosition [:find $userBytes /]; :set userDownload [:pick $userBytes ($slashPosition+1) [:len $userBytes]]; :set users ($users + $x) :set maxDownload ($maxDownload + $userDownload) :set hArray1 $maxDownload :set hArray2 $users :for i from 0 to=([:len $maxDownload]-2) do={ :for j from ($i+1) to=([:len $maxDownload]-1) do={ :set hArray1 0; :set hArray2 0; :set a [:pick $maxDownload $i ($i+1)]; :set b [:pick $maxDownload $j ($j+1)]; :set c [:pick $users $i ($i+1)]; :set d [:pick $users $j ($j+1)]; :if ($a<$b) do={ :set hInt $a; :set a $b; :set b $hInt; :set hInt $c; :set c $d; :set d $hInt; } :set hArray1 ([:pick $maxDownload 0 $i] + $a); :set hArray2 ([:pick $users 0 $i] + $c); :if (($i+1)<$j) do={ :set hArray1 ($hArray1 + [:pick $maxDownload ($i+1) $j]); :set hArray2 ($hArray2 + [:pick $users ($i+1) $j]); } :set hArray1 ($hArray1 + $b); :set hArray2 ($hArray2 + $d); :if (($j+1)<[:len $maxDownload]) do={ :set hArray1 ($hArray1 + [:pick $maxDownload ($j+1) ([:len $maxDownload])]) :set hArray2 ($hArray2 + [:pick $users ($j+1) ([:len $users])]) } :set maxDownload $hArray1 :set users $hArray2 } } :set maxDownload [:pick $maxDownload 0 $top] :set users [:pick $users 0 $top] } :set x ($x+1); } :for i from 0 to=([:len $users]-1) do={ set [:pick $users $i ($i+1)] parent=$badParent; }
Verze 2
:global x 0 :global myParent "wifi" :global badParent "stahovaci" :global userBytes 0/0 :global users 0,0 :global userDownload 0 :global userUpload 0 :global maxDownload 0,0 :global maxUpload 0,0 :global top 10 :global hArray1 :global hArray2 :global hArray3 :global a :global b :global c :global d :global e :global f :global hInt /queue simple :foreach i in=[find parent=$badParent] do={ set $i parent=$myParent; } :foreach i in=[find] do={ :if ([get $i parent]=$myParent) do={ :set userBytes [get $i bytes]; :local slashPosition [:find $userBytes /]; :set userDownload [:pick $userBytes ($slashPosition+1) [:len $userBytes]]; :set userUpload [:pick $userBytes 0 $slashPosition]; :set users ($users + $x) :set maxDownload ($maxDownload + $userDownload) :set maxUpload ($maxUpload + $userUpload) :set hArray1 $maxDownload :set hArray2 $maxUpload :set hArray3 $users :for i from 0 to=([:len $maxDownload]-2) do={ :for j from ($i+1) to=([:len $maxDownload]-1) do={ :set hArray1 0; :set hArray2 0; :set hArray3 0; :set a [:pick $maxDownload $i ($i+1)]; :set b [:pick $maxDownload $j ($j+1)]; :set c [:pick $maxUpload $i ($i+1)]; :set d [:pick $maxUpload $j ($j+1)]; :set e [:pick $users $i ($i+1)]; :set f [:pick $users $j ($j+1)]; :if ($a<$b or $c<$d) do={ :set hInt $a; :set a $b; :set b $hInt; :set hInt $c; :set c $d; :set d $hInt; :set hInt $e; :set e $f; :set f $hInt; } :set hArray1 ([:pick $maxDownload 0 $i] + $a); :set hArray2 ([:pick $maxUpload 0 $i] + $c); :set hArray3 ([:pick $users 0 $i] + $e); :if (($i+1)<$j) do={ :set hArray1 ($hArray1 + [:pick $maxDownload ($i+1) $j]); :set hArray2 ($hArray2 + [:pick $maxUpload ($i+1) $j]); :set hArray3 ($hArray3 + [:pick $users ($i+1) $j]); } :set hArray1 ($hArray1 + $b); :set hArray2 ($hArray2 + $d); :set hArray3 ($hArray3 + $f); :if (($j+1)<[:len $maxDownload]) do={ :set hArray1 ($hArray1 + [:pick $maxDownload ($j+1) ([:len $maxDownload])]) :set hArray2 ($hArray2 + [:pick $maxUpload ($j+1) ([:len $maxUpload])]) :set hArray3 ($hArray3 + [:pick $users ($j+1) ([:len $users])]) } :set maxDownload $hArray1 :set maxUpload $hArray2 :set users $hArray3 } } :set maxDownload [:pick $maxDownload 0 $top] :set maxUpload [:pick $maxUpload 0 $top] :set users [:pick $users 0 $top] } :set x ($x+1); } :for i from 0 to=([:len $users]-1) do={ set [:pick $users $i ($i+1)] parent=$badParent; }