/// <summary> /// Determines whether the specified board is of the current level. /// </summary> /// <param name="board">The board.</param> /// <returns> /// <c>true</c> if the specified board is of the current level, otherwise <c>false</c>. /// </returns> public bool IsMatchLevel(TemplateBoardDbModel board) { return(board.EmptyCellsCount >= LowerBound && board.EmptyCellsCount < UpperBound); }
/// <inheritdoc /> public DifficultyLevel Assign(TemplateBoardDbModel template) { return(levels.FirstOrDefault(level => level.IsMatchLevel(template)) ?? throw new AssignBoardLevelException($"Level with {template.EmptyCellsCount} empty cells can not be assigned. Template board id: {template.Id}'")); }