本文整理汇总了C#中Move.AddPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Move.AddPoint方法的具体用法?C# Move.AddPoint怎么用?C# Move.AddPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Move
的用法示例。
在下文中一共展示了Move.AddPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseMoveHint
//.........这里部分代码省略.........
if (point_strings[point_strings.Length - 1][0] == 'o')
points.Insert(points.Count, -1);
// points should be sorted from highest to lowest at this point
// calculate the missing way points
if (dice[0] != dice[1])
{
if (count == 1 && points.Count == 2)
{
int distance = points[0] - points[1];
int bigger_die = Math.Max(dice[0], dice[1]);
int smaller_die = Math.Min(dice[0], dice[1]);
if (distance > bigger_die)//(points[0] - points[1]) == (dice[0] + dice[1]))
{
if (distance == (dice[0] + dice[1]))
{
// Must not contain hits, because gnubg tells about the hit points seperately.
if (gamestate.Board.PointCount(gamestate.PlayerOnRoll, points[0] - bigger_die) >= 0)
points.Insert(0, (points[0] - bigger_die));
else
points.Insert(0, (points[0] - smaller_die));
}
else if (points[0] - bigger_die < smaller_die) // bearoff from 6 with 52, need first to do the smaller one.
{
if (gamestate.Board.PointCount(gamestate.PlayerOnRoll, points[0] - smaller_die) >= 0) // Was broken without this condition on _ _ 8x 2o 2o 2o with dice 43
points.Insert(0, (points[0] - smaller_die));
else if (gamestate.Board.PointCount(gamestate.PlayerOnRoll, points[0] - smaller_die) == -1)
points.Insert(0, (points[0] - bigger_die));
else
{
}
}
else
{
throw new InvalidOperationException("Cannot handle this. Help!");
}
/*if (gamestate.Board.PointCount(gamestate.PlayerOnRoll, points[0] - bigger_die) > -2)
points.Insert(0, (points[0] - bigger_die));
else
points.Insert(0, (points[0] - smaller_die));*/
} // This is for lonely bearoffs like |_ _ x _ x x| with 41, gnubg gives one of the hints as '4/off'.
// We want atleast 2 chequers on the field because otherwise adding a waypoint is unnecessary inbetween.
else if (total_hints == 1 && gamestate.Board.FinishedCount(gamestate.PlayerOnRoll) <= 13 && points[1] == -1 && (points[0] - smaller_die >= 0) && gamestate.Board.PointCount(gamestate.PlayerOnRoll, points[0] - smaller_die) >= 0 && gamestate.Board.LastChequer(gamestate.PlayerOnRoll) <= points[0])
{
points.Insert(0, (points[0] - smaller_die));
}
else
{
}
}
}
else
{
for (int i = 0; i < points.Count - 1; i++)
{
// This was broken with bearoffs without this condition (ie. 6/off with 44, the below else condition should handle this situation)
/*if (points[i + 1] > -1)
{*/
int gaps = (points[i] - points[i + 1]) / dice[0];
int mod = (points[i] - points[i + 1]) % dice[0];
if (mod > 0)
gaps++;
if (gaps > 1)
{
for (int c = 1; c < gaps; c++)
{
points.Insert(i + 1, points[i] - dice[0]);
i++;
}
}
/*}
else
{
int gaps = (points[i] - points[i + 1]) / dice[0];
int mod = (points[i] - points[i + 1]) % dice[0];
if (mod > 0)
{
for (int c = 0; c < gaps; c++)
{
points.Insert(i + 1, points[i] - dice[0]);
i++;
}
}
}*/
}
}
Move move = new Move();
foreach (int point in points)
{
if (hitpoints.Contains(point))
move.AddHitPoint(point);
else
move.AddPoint(point);
}
return move;
}