예제 #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
        private static bool IsAMatchPossible(TileCollectionB board)
        {
            ulong tiles = board.GetTiles();

            return(BitShifter.IsMatchPossible(tiles));
        }
예제 #3
0
 public void Reset(TileCollectionB parentCollection)
 {
     tileCollection = parentCollection.Clone();
     IsWinner       = false;
 }