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 47: Řádek 47:
           :set hArray2 ($hArray2 + [:pick $users ($i+1) $j]);
           :set hArray2 ($hArray2 + [:pick $users ($i+1) $j]);
         }
         }
: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 + [:pick $users ($j+1) ([:len $users])])
          :set hArray2 ($hArray2 + [:pick $users ($j+1) ([:len $users])])
}
        }
:set maxDownload $hArray1
        :set maxDownload $hArray1
:set users $hArray2
        :set users $hArray2
}
      }
}
    }
:set maxDownload [:pick $maxDownload 0 $top]
    :set maxDownload [:pick $maxDownload 0 $top]
:set users [:pick $users 0 $top]
    :set users [:pick $users 0 $top]
}
  }
:set x ($x+1);
  :set x ($x+1);
  }
  }

Verze z 29. 12. 2008, 22:23

:global x 0
:global myParent "wifi"
:global userBytes 0/0
:global users 0,0
:global userDownload 0
:global maxDownload 0,0
:global top 5
:global hArray1
:global hArray2
:global a
:global b
:global c
:global d
:global hInt

/queue simple

: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);
}