当前位置: 首页>>代码示例>>C#>>正文


C# IGame.UndoMove方法代码示例

本文整理汇总了C#中IGame.UndoMove方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.UndoMove方法的具体用法?C# IGame.UndoMove怎么用?C# IGame.UndoMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGame的用法示例。


在下文中一共展示了IGame.UndoMove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNextScores

 private GameState GetNextScores(IGame game, int depth, int playerIndex, IPlayerMove move)
 {
     depth -= 1;
     game.ApplyMove(move);
     GameState nextBestScoredMoves = null;
     if (_transTable != null)
     {
         nextBestScoredMoves = _transTable.GetBestScoredMoves(game.Hash, depth);
     }
     if (nextBestScoredMoves == null)
     {
         nextBestScoredMoves = SearchBestMoves(game, depth, playerIndex);
         if (_transTable != null)
         {
             _transTable.Remember(game.Hash, nextBestScoredMoves, depth);
         }
     }
     game.UndoMove();
     return nextBestScoredMoves;
 }
开发者ID:MingStar,项目名称:SimUniversity,代码行数:20,代码来源:ImprovedEMN.cs

示例2: DoSystemAction

 private void DoSystemAction(IGame game, string instruction)
 {
     string command = instruction.Trim().ToLower();
     switch (command)
     {
         case "s":
             ColorConsole.WriteLine(ConsoleColor.Yellow, "This feature is coming soon.");
             break;
         case "l":
             ColorConsole.WriteLine(ConsoleColor.Yellow, "This feature is coming soon.");
             break;
         case "-":
             game.UndoMove();
             GameController.Viewer.PrintGame();
             break;
         case "p":
             GameController.Viewer.PrintStats();
             break;
         case "/":
             PrintMoves(ConsoleColor.Magenta, ImprovedEMN.Instance.MakeMoves(game));
             break;
         case "m":
             PrintAllMoves(game);
             break;
         default:
             throw new Exception("Not a valid system command");
     }
 }
开发者ID:MingStar,项目名称:SimUniversity,代码行数:28,代码来源:ConsoleHumanPlayer.cs

示例3: SearchBestMoves

 private GameState SearchBestMoves(IGame game, int depth)
 {
     if (game.HasWinner() || depth == 0)
     {
         return new GameState(Evaluate(game));
     }
     var allMoves = game.GenerateAllMoves();
     if (allMoves.Count() == 1)
     {
         return new GameState(allMoves.First(), Evaluate(game));
     }
     var bestMoves = new GameState(game.NumberOfUniversities, double.MinValue);
     int currentUniversityIndex = game.CurrentUniversityIndex;
     foreach (var move in allMoves)
     {
         if (move is IBuildCampusMove || move is IBuildLinkMove || move is ITradingMove)
         {
             game.ApplyMove(move);
             GameState nextScoredMoves = SearchBestMoves(game, depth - 1);
             game.UndoMove();
             bestMoves.TakeIfBetter(nextScoredMoves, currentUniversityIndex, move);
         }
         else if (move is IProbabilityPlayerMove)
         {
             var expectedScores = new GameState(game.NumberOfUniversities, 0);
             foreach (IProbabilityPlayerMove possibleMove in ((IProbabilityPlayerMove) move).AllProbabilityMoves)
             {
                 game.ApplyMove(possibleMove);
                 GameState nextScores = SearchBestMoves(game, depth - 1);
                 game.UndoMove();
                 for (int i = 0; i < expectedScores.Scores.Length; ++i)
                 {
                     expectedScores[i] += possibleMove.Probability.Value*nextScores[i];
                 }
             }
             bestMoves.TakeIfBetter(expectedScores, currentUniversityIndex, move);
         }
     }
     return bestMoves;
 }
开发者ID:MingStar,项目名称:SimUniversity,代码行数:40,代码来源:ExpectiMaxN.cs


注:本文中的IGame.UndoMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。