Skip to content

Instantly share code, notes, and snippets.

@abixalmon
Last active August 29, 2015 14:22
Show Gist options
  • Save abixalmon/57016678c0145bf98c99 to your computer and use it in GitHub Desktop.
Save abixalmon/57016678c0145bf98c99 to your computer and use it in GitHub Desktop.
AvistaZ bonus point formula
<?php
if (count($bonus_users)) {
foreach ($bonus_users as $user_id => $bonus_user) {
$torrents = count($bonus_user['torrents']);
if ($torrents < 10) {
$bonus = max(0.1, (0.05 * $torrents));
} else {
$bonus = min(2, 1 + (0.01 * $torrents));
}
foreach ($bonus_user['torrents'] as $torrent) {
if (carbon($torrent['uploaded_date'])->diffInMonths() > 6 && $torrent['seed'] <= 2 && $torrent['leech'] >= 1) {
$bonus = $bonus + 1;
}
if ($torrent['file_size'] > computer_size(10, 'GB')) {
$bonus = $bonus + 0.1;
}
}
DB::update("UPDATE USERS AND SET THE BONUS POINT!");
}
}
?>
@abixalmon
Copy link
Author

Less than 10 torrents = 0.1 or 0.05 x total_torrents (whichever is larger)
Greater than 10 torrents = 2 or (1 + 0.01 x total_torrents) (whichever is smaller)
-------- PLUS ------- PER TORRENT -------
Old Torrents = 1 (if torrent is 6 month or older AND seed less than 2 AND leech greater than 1)
Big Torrents = 0.1 (larger than 10GB file)

Example:
Seed 10 torrents => 10 x 0.05 = 0.5 point per hour
Seed 60 torrents => 1 + (60 x 0.01) = 1.6 point per hour
Seed 300 torrents => 1 + (300 x 0.01) = 4 / but you only get 2 points per hour
+
Seed 2 old torrents, with less than 2 seeders and more than 1 leech = 2 points per hour
+
Seed 5 big torrents, size larger than 10GB => 5 x 0.1 = 0.5 point per hour

Finally: So if you seed 60 torrents where 2 are old torrents and 5 are big torrents, you get 1.6 + 2 + 0.5 = 4.1 points per hour

@yeuser
Copy link

yeuser commented May 30, 2015

Based on your gist, you made a mistake on explaining: (Example section)

Seed 9 torrents => 9 x 0.05 = 0.45 point per hour
Seed 10 torrents => 1 + (10 x 0.01) = 1.1 point per hour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment