コード例 #1
0
 public Direction GetBestMoveDirection(TileCollectionB board)
 {
     // TileCollectionB clone = board.Clone();
     gameEngine.Reset(board);
     (int score, Direction direction)bestMove = (int.MinValue, Direction.Down);
     foreach (Direction direction in directions)
     {
         TestMove(direction);
         if (gameEngine.HasBoardChanged())
         {
             gameEngine.UpdateAllTiles(false);
             int expectedScore = ScoreBestFollowingMove();
             if (expectedScore >= bestMove.score)
             {
                 bestMove.score     = expectedScore;
                 bestMove.direction = direction;
             }
         }
         gameEngine.Reset(board);
     }
     return(bestMove.direction);
 }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: geswan/TileAuto
        private static bool IsAMatchPossible(TileCollectionB board)
        {
            ulong tiles = board.GetTiles();

            return(BitShifter.IsMatchPossible(tiles));
        }
コード例 #3
0
ファイル: GameEngine.cs プロジェクト: geswan/TileAuto
 public void Reset(TileCollectionB parentCollection)
 {
     tileCollection = parentCollection.Clone();
     IsWinner       = false;
 }