本文整理汇总了C#中Situation.UnfoldMultiples方法的典型用法代码示例。如果您正苦于以下问题:C# Situation.UnfoldMultiples方法的具体用法?C# Situation.UnfoldMultiples怎么用?C# Situation.UnfoldMultiples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Situation
的用法示例。
在下文中一共展示了Situation.UnfoldMultiples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
List<Position> positionList = new List<Position>();
positionList.AddRange(new Position[] { Position.GreenGoal4, Position.GreenGoal3, Position.GreenGoal2, Position.GreenGoal1});
for (int p = (int)Position.Yellow6; p >= (int)Position.GreenStart; p--)
{
positionList.Add((Position)p);
}
positionList.AddRange(new Position[] { Position.GreenHome4, Position.GreenHome3, Position.GreenHome2, Position.GreenHome1 });
Position[] positionOrder = positionList.ToArray();
int len = positionOrder.Length;
int homeStart = len-4;
bool first = true;
for (int i = 0; i < len; i++)
{
for (int j = Math.Max(i, 1); j < len; j++)
{
if (i == j && i >= homeStart)
continue;
for (int k = Math.Max(j, 2); k < len; k++)
{
if (j == k && j >= homeStart)
continue;
for (int l = Math.Max(k,3); l < len; l++)
{
if (k == l && k >= homeStart)
continue;
var pos = getStartPositions();
pos[0] = positionOrder[i];
pos[1] = positionOrder[j];
pos[2] = positionOrder[k];
pos[3] = positionOrder[l];
Situation sit = new Situation(pos);
Situation s2 = new Situation(sit);
if (s2.UnfoldMultiples(Piece.Green))
{
continue;
}
int nomoves = 0;
decimal ev = 0;
if (first)
{
SaveValue(sit, 0);
first = false;
continue;
}
for (int roll = 1; roll <= 6; roll++)
{
Move[] moves = sit.GetMoves(Piece.Green, roll);
if (moves.Length == 0)
{
nomoves++;
}
else
{
decimal value = Decimal.MaxValue;
foreach(Move move in moves)
{
Situation s = new Situation(sit);
s.ApplyMove(move);
value = Math.Min(value, GetValue(s));
}
ev += value;
}
}
if (sit.GetNumberOfTries(Piece.Green) == 3)
{
ev = (5 * nomoves * nomoves + (36 + 6 * nomoves + nomoves * nomoves) * ev) / (216 - nomoves * nomoves * nomoves);
}
else
{
ev = (5 + ev) / (6 - nomoves);
}
SaveValue(sit, ev);
Console.WriteLine(positionOrder[i] + " "
+ positionOrder[j] + " "
+ positionOrder[k] + " "
+ positionOrder[l] + ": " + ev);
}
}
}
}
Byte[] bytes = new Byte[6 * dict.Count];
int offset = 0;
foreach (KeyValuePair<int, decimal> kvp in dict)
{
//.........这里部分代码省略.........