public async Task TrySolve(string number, string input, SocketGuildUser solver) { if (IsFinished != true) { if (CurrentLockNumber.HasValue) { var curLock = Locks.FirstOrDefault(x => x.LockNumber == CurrentLockNumber.Value); if (curLock.TrySolve(number, input, solver)) { CurrentOrderIndex++; if (CurrentOrderIndex >= 10) { IsFinished = true; StringBuilder builder = new StringBuilder(); builder.AppendLine("```LOCK::LIFTED"); builder.AppendLine("SOLVERS::PRINT()"); var users = Locks.Select(x => x.Solver).Distinct(); foreach (var user in users) { int amountSolved = Locks.Count(x => x.Solver.Id == user.Id); builder.AppendLine($"SOLVER::{user.Nickname}|ID::{user.Id}|SOLVED::{amountSolved}"); } builder.AppendLine($"|{new string('-', 10)}PUZZLE_OVER{new string('-', 10)}|```"); await PresentationMessage.ModifyAsync(x => x.Content = builder.ToString()); PuzzleSolved?.Invoke(this.Guid); } else { if (CurrentOrderIndex > 0) { PreviousLockNumber = NumbersOrder[CurrentOrderIndex - 1]; } else { PreviousLockNumber = null; } if (NumbersOrder.ElementAtOrDefault(CurrentOrderIndex) != 10) { CurrentLockNumber = NumbersOrder[CurrentOrderIndex]; } else { CurrentLockNumber = null; } if (NumbersOrder.ElementAtOrDefault(CurrentOrderIndex + 1) != 0) { NextLockNumber = NumbersOrder[CurrentOrderIndex + 1]; } else { NextLockNumber = null; } await LockSolved?.Invoke(); } } } } }