-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mean value drawing #14
Conversation
Looks good so far. Language entries for |
Matching the style we use for PHP
@@ -182,4 +182,28 @@ private static function get_min_rating_of_all(match_players_list ...$players_lis | |||
return $list->get_min_rating(); | |||
}, $players_lists)); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this whole block: indent is 4 spaces, please adjust accordingly :)
$value += $list->get_total_rating(); | ||
$number += $list->length(); | ||
} | ||
return $value/$number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preferred: return $value / $number;
you also typehinted int
as a return value, but this division does not always result in an integer. is this desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, sry. In java (the only programming language I really know better) int
/ int
is automatically casted to an int
. The intention was that the result is implicitly casted to an int
. (i.e. all digits of the float behind the "." are thrown away.) I hope php does that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Des- yes, that is what would happen in php too. i was not sure wether that was intentional here ^^
return $value/$number; | ||
} | ||
|
||
public static function get_abs_rating_variance(match_players_list ...$players_lists): int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be awesome to have a unit test for this public method :)
deleted whitespaces... Co-Authored-By: Des- <danielschmand@gmx.de>
Changed the drawing algo such that it can choose the permutation of the number of players in a way that minimizes the rating variance.
CARE: Needs more adjustment. After pull, please check if data field "nczone_draw_factor" is in the db and needs finetuning wrt factor. Currently 0.4 seems nice, however 0.0 is the old algo.