use of jskills.ITeam in project ACManager by kun368.
the class PlayerPriorValuesToSkillsLayer method buildLayer.
@Override
public void buildLayer() {
for (ITeam currentTeam : teams) {
List<KeyedVariable<IPlayer, GaussianDistribution>> currentTeamSkills = new ArrayList<>();
for (Entry<IPlayer, Rating> currentTeamPlayer : currentTeam.entrySet()) {
KeyedVariable<IPlayer, GaussianDistribution> playerSkill = createSkillOutputVariable(currentTeamPlayer.getKey());
AddLayerFactor(createPriorFactor(currentTeamPlayer.getKey(), currentTeamPlayer.getValue(), playerSkill));
currentTeamSkills.add(playerSkill);
}
addOutputVariableGroup(currentTeamSkills);
}
}
use of jskills.ITeam in project VoxelGamesLibv2 by VoxelGamesLib.
the class EloHandler method handleGameEnd.
/**
* Handles the elo calculation for generic games
*
* @param game the game that ended
* @param users the users which played this game, in order, first = winner
*/
public void handleGameEnd(@Nonnull Game game, @Nonnull User... users) {
List<ITeam> teams = new ArrayList<>();
for (User user : users) {
teams.add(new jskills.Team(user, user.getRating(game.getGameMode())));
}
Map<IPlayer, Rating> newRatings = calculator.calculateNewRatings(game.getGameMode(), teams, IntStream.of(users.length).toArray());
update(game, newRatings);
}
use of jskills.ITeam in project faf-java-server by FAForever.
the class RatingService method calculateQuality.
public double calculateQuality(Rating left, Rating right) {
jskills.Rating leftRating = ofNullable(left).map(rating -> new jskills.Rating(left.getMean(), left.getDeviation())).orElse(gameInfo.getDefaultRating());
jskills.Rating rightRating = ofNullable(left).map(rating -> new jskills.Rating(right.getMean(), right.getDeviation())).orElse(gameInfo.getDefaultRating());
Collection<ITeam> teams = Arrays.asList(new Team(new Player<>(1), leftRating), new Team(new Player<>(2), rightRating));
return TrueSkillCalculator.calculateMatchQuality(gameInfo, teams);
}
Aggregations