本文整理汇总了C#中Point2D.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Point2D.Move方法的具体用法?C# Point2D.Move怎么用?C# Point2D.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D.Move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcRoutAndDeliver
public Dictionary<Point2D, int> CalcRoutAndDeliver(IEnumerable<DirectionType> directions)
{
Point2D currentPos = new Point2D(0, 0);
Dictionary<Point2D, int> map = new Dictionary<Point2D, int>();
map.Add(currentPos, 1);
foreach (var direction in directions)
{
currentPos = currentPos.Move(direction);
AddGiftToPos(currentPos, map);
}
return map;
}
示例2: GetNumberOfHousesWithGiftsUsingRobo
public int GetNumberOfHousesWithGiftsUsingRobo(IEnumerable<char> chars)
{
var directions = GetDirections(chars);
Point2D santa = new Point2D(0, 0);
Point2D robo = new Point2D(0, 0);
Dictionary<Point2D, int> map = new Dictionary<Point2D, int>();
AddGiftToPos(santa, map);
AddGiftToPos(robo, map);
int moves = 0;
foreach (var direction in directions)
{
if (moves % 2 == 0)
{
santa = santa.Move(direction);
AddGiftToPos(santa, map);
}
else
{
robo = robo.Move(direction);
AddGiftToPos(robo, map);
}
moves++;
}
return map.Count;
}