Skip to content

Commit

Permalink
Make range of skills per-gender also
Browse files Browse the repository at this point in the history
Update version number
Update readme with new algorithm details
  • Loading branch information
smashery committed Sep 5, 2015
1 parent baf4a16 commit f257ec3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 45 deletions.
4 changes: 2 additions & 2 deletions KingsAndQueensHat/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
13 changes: 8 additions & 5 deletions KingsAndQueensHat/TeamGeneration/RangeOfSkillsPenalty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ namespace KingsAndQueensHat.TeamGeneration
public class RangeOfSkillsPenalty : IPenalty
{
/// <summary>
/// All teams having similar standard deviation of player skills makes for a good result
/// All teams having similar standard deviation of player skills per gender makes for a good result
/// </summary>
public double ScorePenalty(List<Team> teams)
{
var standardDeviations = teams.Select(t => HatMath.StdDeviation(t.Players.Select(p => (double)p.SkillValue).ToList())).ToList();
var x = teams.Select(t => t.Players.Select(p => p.Skill)).ToList();
// Yo dawg
var result = HatMath.StdDeviation(standardDeviations);
double result = 0;
foreach (var gender in new[] { Gender.Male, Gender.Female })
{
var standardDeviations = teams.Select(t => HatMath.StdDeviation(t.Players.Where(p => p.Gender == gender).Select(p => (double)p.SkillValue).ToList())).ToList();
// Yo dawg
result += HatMath.StdDeviation(standardDeviations);
}
return result;
}

Expand Down
Loading

0 comments on commit f257ec3

Please sign in to comment.