Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 public int getRank(Player player)
 {
     return Ranks.IndexOf(player)+1;
 }
Exemplo n.º 6
0
 public void addMember(Player player, int race)
 {
     addMember(player);
     setRace(player, race);
 }
Exemplo n.º 7
0
 public void addMember(Player player)
 {
     members.Add(player.Name, player);
 }
Exemplo n.º 8
0
 public void setRace(Player player, int race)
 {
     selectedRace[player.Name]= race;
 }
Exemplo n.º 9
0
 public void RemoveMember(Player player)
 {
     members.Remove(player.Name);
     selectedRace.Remove(player.Name);
 }
Exemplo n.º 10
0
 public PlayerWrapper(Player player, int race, int teamNumber)
 {
     this.Player = player;
     this.Race = race;
     this.TeamNumber = teamNumber;
 }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 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();
 }