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