Updated editorconfig to (mostly?) require braces around if/else statements, and applied the new formatting rules

This commit is contained in:
Kwoth
2022-02-02 01:44:45 +01:00
parent b22cd5a81e
commit ffa2c3f119
202 changed files with 2108 additions and 920 deletions

View File

@@ -11,7 +11,10 @@ public class TriviaQuestion
//represents the min size to judge levDistance with
private static readonly HashSet<Tuple<int, int>> _strictness = new()
{
new(9, 0), new(14, 1), new(19, 2), new(22, 3)
new(9, 0),
new(14, 1),
new(19, 2),
new(22, 3)
};
public string Category { get; set; }
@@ -44,9 +47,11 @@ public class TriviaQuestion
public bool IsAnswerCorrect(string guess)
{
if (Answer.Equals(guess, StringComparison.InvariantCulture)) return true;
if (Answer.Equals(guess, StringComparison.InvariantCulture))
return true;
var cleanGuess = Clean(guess);
if (CleanAnswer.Equals(cleanGuess, StringComparison.InvariantCulture)) return true;
if (CleanAnswer.Equals(cleanGuess, StringComparison.InvariantCulture))
return true;
var levDistanceClean = CleanAnswer.LevenshteinDistance(cleanGuess);
var levDistanceNormal = Answer.LevenshteinDistance(guess);
@@ -57,12 +62,14 @@ public class TriviaQuestion
private static bool JudgeGuess(int guessLength, int answerLength, int levDistance)
{
foreach (var level in _strictness)
{
if (guessLength <= level.Item1 || answerLength <= level.Item1)
{
if (levDistance <= level.Item2)
return true;
return false;
}
}
return false;
}