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); }
private static bool IsAMatchPossible(TileCollectionB board) { ulong tiles = board.GetTiles(); return(BitShifter.IsMatchPossible(tiles)); }
public void Reset(TileCollectionB parentCollection) { tileCollection = parentCollection.Clone(); IsWinner = false; }