本文整理汇总了C#中Simulator.Simulate方法的典型用法代码示例。如果您正苦于以下问题:C# Simulator.Simulate方法的具体用法?C# Simulator.Simulate怎么用?C# Simulator.Simulate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator
的用法示例。
在下文中一共展示了Simulator.Simulate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMoves
public GameMove[] GetMoves(Pod[] pod, Pod[] opp)
{
GameMove[] moves = new GameMove[4];
moves = (new SimpleStrategy()).GetMoves(pod, opp);
List<GameMove[]> altMoves = GameMove.GenerateMoves(moves);
Simulator sim = new Simulator();
double maxU = Double.MinValue;
int maxInd = 0;
for (int i = 0; i < altMoves.Count; i++)
{
Situation situation = sim.Simulate(pod[0], pod[1], opp[0], opp[1], altMoves[i], Opp);
//Console.Error.WriteLine("thrust1: {0}, thrust2: {1}", altMoves[i][0].Thrust, altMoves[i][1].Thrust);
//situation.Print();
double utility = situation.Utility();
//Console.Error.WriteLine("Utility {0} = {1}", i, utility);
if (utility > maxU)
{
maxU = utility; maxInd = i;
}
}
GameMove moveWithShield = GameMove.MoveWithShield(altMoves[maxInd][0]);
Situation sit = sim.Simulate(pod[0], pod[1], opp[0], opp[1], new GameMove[] {
moveWithShield, altMoves[maxInd][1], altMoves[maxInd][2], altMoves[maxInd][3]});
if (sit.Utility() > maxU + 30 && !(pod[0].Lap == laps && pod[0].NextCP == 0))
{
//moveWithShield.Print();
altMoves[maxInd][0] = moveWithShield;
}
moveWithShield = GameMove.MoveWithShield(altMoves[maxInd][1]);
sit = sim.Simulate(pod[0], pod[1], opp[0], opp[1], new GameMove[] {
altMoves[maxInd][0], moveWithShield, altMoves[maxInd][2], altMoves[maxInd][3]});
if (sit.Utility() > maxU + 40 && !(pod[1].Lap == laps && pod[1].NextCP == 0))
{
//moveWithShield.Print();
altMoves[maxInd][1] = moveWithShield;
}
return altMoves[maxInd];
}