public static int getK(Player player, int race) { int K = Constants.K3; if ((player.Victory[race] + player.Defeat[race]) < Constants.K1seuil_games) { K = Constants.K1; } else if (player.Elo[race] < Constants.K2seuil_elo) { K = Constants.K2; } return K; }
public static void compute(bool victory, Player player, int race, int eloTeam, int eloAdv, int teamNumber) { int W = Constants.WDefeat; int coeff; if (victory) { W = Constants.WVictory; player.Victory[race]++; coeff = teamNumber - 1; } else { player.Defeat[race]++; coeff = 1; } double incr = (double) getK(player, race) * ((double) W - proba(eloTeam, eloAdv)) * coeff; player.Elo[race] += (int)incr; }
private void updateInformation(Player player) { radioButtonTerran.Enabled = player.Races[Constants.Terran]; radioButtonZerg.Enabled = player.Races[Constants.Zerg]; radioButtonProtoss.Enabled = player.Races[Constants.Protoss]; radioButtonRandom.Enabled = player.Races[Constants.Random]; radioButtonTerran.Checked = false; radioButtonZerg.Checked = false; radioButtonProtoss.Checked = false; radioButtonRandom.Checked = false; if (radioButtonTerran.Enabled) { radioButtonTerran.Checked = true; } else if (radioButtonZerg.Enabled) { radioButtonZerg.Checked = true; } else if (radioButtonProtoss.Enabled) { radioButtonProtoss.Checked = true; } else { radioButtonRandom.Checked = true; } numericUpDownTeam.Value = 1; if (teams[(int)numericUpDownTeam.Value - 1].Count == mainForm.Core.getExpectedTeamPlayerNumber()) { buttonAdd.Enabled = false; }else if (teams[(int)numericUpDownTeam.Value - 1].Count<mainForm.Core.getExpectedTeamPlayerNumber()) { buttonAdd.Enabled = true; } }
public void modifyPlayer(Player player, string newname, bool terran, bool zerg, bool protoss, bool random) { HumanPlayers.Remove(player.Name); player.Name = newname; player.raceMask(terran, zerg, protoss, random); HumanPlayers.Add(newname, player); computeRanks(); }
public int getRank(Player player) { return Ranks.IndexOf(player)+1; }
public void addMember(Player player, int race) { addMember(player); setRace(player, race); }
public void addMember(Player player) { members.Add(player.Name, player); }
public void setRace(Player player, int race) { selectedRace[player.Name]= race; }
public void RemoveMember(Player player) { members.Remove(player.Name); selectedRace.Remove(player.Name); }
public PlayerWrapper(Player player, int race, int teamNumber) { this.Player = player; this.Race = race; this.TeamNumber = teamNumber; }
public PlayerForm(MainForm mainForm, Player player) { this.mainForm = mainForm; this.player = player; this.newPlayer = false; InitializeComponent(); textBoxName.Text = player.Name; checkBoxTerran.Checked = player.Races[Constants.Terran]; checkBoxZerg.Checked = player.Races[Constants.Zerg]; checkBoxProtoss.Checked = player.Races[Constants.Protoss]; checkBoxRandom.Checked = player.Races[Constants.Random]; comboBoxTerran.Enabled = false; comboBoxZerg.Enabled = false; comboBoxProtoss.Enabled = false; comboBoxRandom.Enabled = false; }
private void updateInformation(Player player) { core.computeRanks(); nameContent.Text = player.Name; rankedContent.Text = core.getRank(player).ToString(); if (player.hasBeenPlayed(Constants.Terran)) { terranContent.Text = "Win: " + player.Victory[Constants.Terran] + ", Loss: " + player.Defeat[Constants.Terran] + ", Elo: " + player.Elo[Constants.Terran]; } else { terranContent.Text = "Estimated Elo: " + player.Elo[Constants.Terran]; } if (player.hasBeenPlayed(Constants.Zerg)) { zergContent.Text = "Win: " + player.Victory[Constants.Zerg] + ", Loss: " + player.Defeat[Constants.Zerg] + ", Elo: " + player.Elo[Constants.Zerg]; } else { zergContent.Text = "Estimated Elo: " + player.Elo[Constants.Zerg]; } if (player.hasBeenPlayed(Constants.Protoss)) { protossContent.Text = "Win: " + player.Victory[Constants.Protoss] + ", Loss: " + player.Defeat[Constants.Protoss] + ", Elo: " + player.Elo[Constants.Protoss]; } else { protossContent.Text = "Estimated Elo: " + player.Elo[Constants.Protoss]; } if (player.hasBeenPlayed(Constants.Random)) { randomContent.Text = "Win: " + player.Victory[Constants.Random] + ", Loss: " + player.Defeat[Constants.Random] + ", Elo: " + player.Elo[Constants.Random]; } else { randomContent.Text = "Estimated Elo: " + player.Elo[Constants.Random]; } overallContent.Text = "Win: " + player.getOverallVictory() + ", Loss: " + player.getOverallDefeat() + ", Elo: " + player.getOverallElo(); terranContent.Enabled = player.Races[Constants.Terran]; labelTerran.Enabled = player.Races[Constants.Terran]; zergContent.Enabled = player.Races[Constants.Zerg]; labelZerg.Enabled = player.Races[Constants.Zerg]; protossContent.Enabled = player.Races[Constants.Protoss]; labelProtoss.Enabled = player.Races[Constants.Protoss]; randomContent.Enabled = player.Races[Constants.Random]; labelRandom.Enabled = player.Races[Constants.Random]; terranContent.ForeColor = labelTerran.ForeColor; zergContent.ForeColor = labelZerg.ForeColor; protossContent.ForeColor = labelProtoss.ForeColor; randomContent.ForeColor = labelRandom.ForeColor; }
public void modifyPlayer(Player player, string newname, bool terran, bool zerg, bool protoss, bool random) { bool checkedItem = checkedListBoxHumanPlayers.GetItemChecked(checkedListBoxHumanPlayers.Items.IndexOf(player)); checkedListBoxHumanPlayers.Items.Remove(player); core.modifyPlayer(player, newname, terran, zerg, protoss, random); checkedListBoxHumanPlayers.Items.Add(core.HumanPlayers[newname], checkedItem); checkedListBoxHumanPlayers.SelectedItem=core.HumanPlayers[newname]; updateDetailsDisplay(); }