public void run() { var randomNumbers = randomProvider.rand(settings); for (int i = 0; i < randomNumbers.Length; ++i) { currentNumbers[i] = randomNumbers[i]; } sendOutputProvider.sendOutput(currentNumbers); bool exitCondition = false; while (!exitCondition) { checkInput(); if (inputValue != 0) { MyType[] tempNumbers = new MyType[settings.NumberOfValues]; try { for (int i = 0; i < currentNumbers.Length; ++i) { tempNumbers[i] = checked (currentNumbers[i] * inputValue); } for (int i = 0; i < currentNumbers.Length; ++i) { currentNumbers[i] = tempNumbers[i]; } storageProvider.push(inputValue); } catch (Exception) { Console.WriteLine(textMessages.MaxLevelReached); if (storageProvider.Count > 0) { for (int i = 0; i < currentNumbers.Length; ++i) { currentNumbers[i] = currentNumbers[i] / storageProvider.peek(); } storageProvider.pop(); } } sendOutputProvider.sendOutput(currentNumbers); } else { if (storageProvider.Count > 0) { for (int i = 0; i < currentNumbers.Length; ++i) { currentNumbers[i] = currentNumbers[i] / storageProvider.peek(); } sendOutputProvider.sendOutput(currentNumbers); storageProvider.pop(); } else { sendOutputProvider.printOutput(textMessages.EndReached); Console.ReadKey(); exitCondition = true; } } } }