本文整理汇总了C#中Agent.UpdateGrid方法的典型用法代码示例。如果您正苦于以下问题:C# Agent.UpdateGrid方法的具体用法?C# Agent.UpdateGrid怎么用?C# Agent.UpdateGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent.UpdateGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunGameInBrowser
private static void RunGameInBrowser()
{
using (var game = new GamePage())
{
var agent = new Agent(game.GridState, new ProbabilityLimitedExpectiMaxerFactory(), new VictorHeuristic());
try
{
while (true)
{
var result = agent.MakeDecision();
game.Turn(result.BestMove);
agent.UpdateGrid(game.GridState);
}
}
catch (GameOverException)
{
game.TakeScreenshot().SaveAsFile("game_" + game.Score + ".png", ImageFormat.Png);
Console.WriteLine(game.Score);
}
}
}
示例2: RunGameInConsole
private static LogarithmicGrid RunGameInConsole()
{
var logGrid = new LogarithmicGrid(new byte[4, 4]).AddRandomTile().AddRandomTile();
var agent = new Agent(logGrid, new ProbabilityLimitedExpectiMaxerFactory(), new OvolveHeuristic());
try
{
int counter = 0;
while (true)
{
counter++;
var startTime = SystemClock.Instance.Now;
Console.WriteLine("Start next move calculation...");
var result = agent.MakeDecision();
var elapsed = SystemClock.Instance.Now - startTime;
Console.Clear();
Console.WriteLine("End move calcualtion, time taken: {0}", elapsed.ToString("ss.fff", CultureInfo.InvariantCulture));
Console.WriteLine();
Console.WriteLine(result);
PrintTimings(agent);
logGrid = logGrid.MakeMove(result.BestMove).AddRandomTile();
agent.UpdateGrid(logGrid);
}
}
catch (GameOverException)
{
Console.WriteLine("GAME OVER!");
}
return logGrid;
}