private BoggleResult CreateResult(BoggleTracker tracker) { BoggleResult result = new BoggleResult(tracker.Board, tracker.WordPointDict, tracker.Points, tracker.Stopwatch.Elapsed); return(result); }
public BoggleResult Play(IBogglePlayer player, int randomSeed = 0, int boardSize = BoggleRules.BoardSizeDefault) { BoggleBoard board = Rules.GenerateBoard(randomSeed, boardSize); BoggleTracker tracker = CreateTracker(player, board); tracker.Start(); try { player.Solve(board); tracker.Stop(); } catch (Exception) { tracker.Stop(); tracker.Update(string.Empty, BoggleRules.CatastrophicScore); throw; } BoggleResult result = CreateResult(tracker); DeleteTracker(player.Id, board.Id); return(result); }