mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Updated editorconfig to (mostly?) require braces around if/else statements, and applied the new formatting rules
This commit is contained in:
@@ -40,7 +40,8 @@ public partial class Games
|
||||
var (opts, _) = OptionsParser.ParseFrom(new TriviaOptions(), args);
|
||||
|
||||
var config = _gamesConfig.Data;
|
||||
if (config.Trivia.MinimumWinReq > 0 && config.Trivia.MinimumWinReq > opts.WinRequirement) return;
|
||||
if (config.Trivia.MinimumWinReq > 0 && config.Trivia.MinimumWinReq > opts.WinRequirement)
|
||||
return;
|
||||
|
||||
var trivia = new TriviaGame(Strings,
|
||||
_client,
|
||||
|
@@ -198,7 +198,7 @@ public class TriviaGame
|
||||
|
||||
private Task PotentialGuess(SocketMessage imsg)
|
||||
{
|
||||
_= Task.Run(async () =>
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -226,7 +226,8 @@ public class TriviaGame
|
||||
}
|
||||
finally { _guessLock.Release(); }
|
||||
|
||||
if (!guess) return;
|
||||
if (!guess)
|
||||
return;
|
||||
triviaCancelSource.Cancel();
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ public class TriviaQuestionPool
|
||||
|
||||
TriviaQuestion randomQuestion;
|
||||
while (exclude.Contains(randomQuestion = Pool[_rng.Next(0, Pool.Length)]))
|
||||
{
|
||||
{
|
||||
// if too many questions are excluded, clear the exclusion list and start over
|
||||
if (exclude.Count > Pool.Length / 10 * 9)
|
||||
{
|
||||
|
Reference in New Issue
Block a user