本文整理汇总了C#中IGame.IsEndOfGame方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.IsEndOfGame方法的具体用法?C# IGame.IsEndOfGame怎么用?C# IGame.IsEndOfGame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.IsEndOfGame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRounds
private void TestRounds(IGame game)
{
// Quickly push the game to its end:
for(int i = 1; i <= game.MaxNbRound; i++) {
Assert.AreEqual(i, game.CurrentRound);
game.EndRound();
Assert.IsTrue(game.Player2.Equals(game.CurrentPlayer));
game.EndRound();
Assert.IsTrue(game.Player1.Equals(game.CurrentPlayer));
}
Assert.IsTrue(game.IsEndOfGame());
}
示例2: TestWinner
/// <summary>
/// Ends the game quickly and checks the winner by adding
/// a great number of points to each player one after the other.
/// </summary>
/// <param name="game">The game to test.</param>
private void TestWinner(IGame game)
{
game.Player1.AddPoints(1000);
while(!game.IsEndOfGame()) {
game.EndRound();
game.EndRound();
}
Assert.IsTrue(game.GetWinner().Equals(game.Player1));
game.Player2.AddPoints(10000);
Assert.IsTrue(game.GetWinner().Equals(game.Player2));
}