本文整理汇总了C#中Game.Take方法的典型用法代码示例。如果您正苦于以下问题:C# Game.Take方法的具体用法?C# Game.Take怎么用?C# Game.Take使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.Take方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AcceptanceTest
public void AcceptanceTest()
{
var game = new Game(5, 5);
game.Take("1 2 N");
game.Take("LMLMLMLMM");
game.Take("3 3 E");
game.Take("MMRMMRMRRM");
game.WithRobots(robots =>
{
Assert.Equal("1 3 N", robots[0].ToString());
Assert.Equal("5 1 E", robots[1].ToString());
});
}
示例2: MoveRobot
public void MoveRobot()
{
new[]
{
new Tuple<String, Point>("M", new Point(1, 3)),
new Tuple<String, Point>("MMM", new Point(1, 5)),
new Tuple<String, Point>("RMM", new Point(3, 2)),
new Tuple<String, Point>("RMLMLMLM", new Point(1, 2))
}.ToList().ForEach(useCase =>
{
var game = new Game(5, 5);
game.Take("1 2 N");
game.Take(useCase.Item1);
game.WithRobots(robots => Assert.Equal(useCase.Item2, robots[0].Position));
});
}
示例3: PlaceRobot
public void PlaceRobot()
{
var game = new Game(5, 5);
game.Take("1 2 N");
game.WithRobots(robots =>
{
Assert.Equal(1, robots[0].Position.X);
Assert.Equal(2, robots[0].Position.Y);
Assert.Equal('N', robots[0].Orientation);
});
}
示例4: StateIsPreserved
public void StateIsPreserved()
{
var game = new Game(5, 5);
game.Take("0 0 N");
game.Take("M");
game.Take("1 1 E");
game.Take("M");
game.WithRobots(robots =>
{
Assert.Equal("0 1 N", robots[0].ToString());
Assert.Equal("2 1 E", robots[1].ToString());
robots[0].Move();
});
game.WithRobots(robots => Assert.Equal("0 1 N", robots[0].ToString()));
}
示例5: RotateRobot
public void RotateRobot(String input, Char expectedDirection)
{
var game = new Game(5, 5);
game.Take("1 2 N");
game.Take(input);
game.WithRobots(robots => Assert.Equal(expectedDirection, robots[0].Orientation));
}