本文整理汇总了C#中Situation.GetWinner方法的典型用法代码示例。如果您正苦于以下问题:C# Situation.GetWinner方法的具体用法?C# Situation.GetWinner怎么用?C# Situation.GetWinner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Situation
的用法示例。
在下文中一共展示了Situation.GetWinner方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CannotWinWhileTheresBeerLeft
public void CannotWinWhileTheresBeerLeft()
{
var pos = getStartPositions();
pos[0] = Position.GreenGoal1;
pos[1] = Position.GreenGoal2;
pos[2] = Position.GreenGoal3;
pos[3] = Position.GreenGoal4;
var sit = new Situation(pos);
sit.beers[(int)Piece.Green] = 1;
Assert.AreEqual(Piece.None, sit.GetWinner());
sit.DrinkBeers(Piece.Green, 1);
Assert.AreEqual(Piece.Green, sit.GetWinner());
}
示例2: TripleFinishesOverOwnPiece
public void TripleFinishesOverOwnPiece()
{
var pos = getStartPositions();
pos[0] = Position.GreenGoal2;
pos[1] = pos[2] = pos[3] = Position.GreenGoal1;
var sit = new Situation(pos);
var moves = sit.GetMoves(Piece.Green, 3);
sit.ApplyMove(moves[0]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal1]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal2]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal3]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal4]);
Assert.AreEqual(Piece.Green, sit.GetWinner());
}
示例3: TestYellowWins
public void TestYellowWins()
{
Position[] pos = getStartPositions();
pos[12] = Position.YellowGoal1;
pos[13] = Position.YellowGoal2;
pos[14] = Position.YellowGoal4;
pos[15] = Position.YellowGoal3;
Situation start = new Situation(pos);
Assert.AreEqual(Piece.Yellow, start.GetWinner());
}
示例4: DoubleUnfoldsWhenPiecesBeforeItAreFilled
public void DoubleUnfoldsWhenPiecesBeforeItAreFilled()
{
var pos = getStartPositions();
pos[0] = Position.GreenGoal4;
pos[1] = pos[2] = Position.GreenGoal2;
pos[3] = Position.GreenGoal1;
var sit = new Situation(pos);
var moves = sit.GetMoves(Piece.Green, 2);
sit.ApplyMove(moves[0]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal1]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal2]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal3]);
Assert.AreEqual(Piece.Green, sit.board[(int)Position.GreenGoal4]);
Assert.AreEqual(Piece.Green, sit.GetWinner());
}
示例5: TestGreenWins
public void TestGreenWins()
{
Position[] pos = getStartPositions();
pos[0] = Position.GreenGoal2;
pos[1] = Position.GreenGoal1;
pos[2] = Position.GreenGoal4;
pos[3] = Position.GreenGoal3;
Situation start = new Situation(pos);
Assert.AreEqual(Piece.Green, start.GetWinner());
}