本文整理汇总了C#中Statistics.AddGameResult方法的典型用法代码示例。如果您正苦于以下问题:C# Statistics.AddGameResult方法的具体用法?C# Statistics.AddGameResult怎么用?C# Statistics.AddGameResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistics
的用法示例。
在下文中一共展示了Statistics.AddGameResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: okButton_Click
protected void okButton_Click(object sender, EventArgs e)
{
//Game game = new Game();
//game.Play();
//Dart dart = new Dart(random);
//dart.Throw();
//resultLabel.Text = String.Format("Dart landed on {0} with ringmultiplier {1}x", dart.Score, dart.RingMultiplier);
int games = 9999999;
Statistics player1Stats = new Statistics(games);
Statistics player2Stats = new Statistics(games);
for (int i = 0; i < player1Stats.Length; i++)
{
Game game = new Game();
game.Play();
if (game.Player1Score > game.Player2Score)
{
player1Stats.AddGameResult(1);
player2Stats.AddGameResult(0);
}
else
{
player1Stats.AddGameResult(0);
player2Stats.AddGameResult(1);
}
}
//string winningPlayer = "";
//if (game.Player1Score > game.Player2Score)
//{
// winningPlayer = "Player 1";
//}
//else
// winningPlayer = "Player 2";
resultLabel.Text = String.Format("Player 1 won : {0}% of the time.<br/>Player 2 won : {1}% of the time.<br/>",
player1Stats.GetWinPercentage().ToString(),
player2Stats.GetWinPercentage().ToString());
//resultLabel.Text = String.Format("Player 1: {0}<br/>Player 2: {1}<br/>{2} wins!",
// game.Player1Score,
// game.Player2Score,
// winningPlayer);
}