Remove Comments / TODO and set default values

This commit is contained in:
Matti 2024-11-13 22:54:51 +01:00
parent f37af51671
commit d06d1021be

View File

@ -34,7 +34,6 @@ std::vector<std::string> generateSecretCode(int digits, int optionsPerDigit) {
for (int i = 0; i < digits; i++) { for (int i = 0; i < digits; i++) {
int digit = getRandomNumberInRange(1, optionsPerDigit); int digit = getRandomNumberInRange(1, optionsPerDigit);
secretCode.push_back(std::to_string(digit)); secretCode.push_back(std::to_string(digit));
// std::cout << "Secret Code was set as " << digit << std::endl;
} }
return secretCode; return secretCode;
@ -46,9 +45,7 @@ std::vector<std::string> getCodeGuessFromConsole(int codeLength, int livesRemain
std::vector<std::string> guess; std::vector<std::string> guess;
// TODO Make limit dynamic
for (int i = 1; i <= codeLength; ++i) { for (int i = 1; i <= codeLength; ++i) {
// std::cout << "Enter Digit " << i << " : " << std::endl;
std::string input; std::string input;
std::cin >> input; std::cin >> input;
@ -105,9 +102,9 @@ int countMatches(std::vector<std::string> &v1, std::vector<std::string> &v2) {
} }
void Aufg5Main() { void Aufg5Main() {
int optionsPerDigit = 99; int optionsPerDigit = 4;
int codeLength = 1; int codeLength = 4;
int livesRemaining = 2; int livesRemaining = 6;
std::cout << optionsPerDigit << " options per Digit" << std::endl; std::cout << optionsPerDigit << " options per Digit" << std::endl;
std::cout << codeLength << " Code Length" << std::endl; std::cout << codeLength << " Code Length" << std::endl;
std::cout << livesRemaining << " Lives Remaining" << std::endl; std::cout << livesRemaining << " Lives Remaining" << std::endl;
@ -115,7 +112,6 @@ void Aufg5Main() {
std::vector<std::string> SecretCode = generateSecretCode(codeLength, optionsPerDigit); std::vector<std::string> SecretCode = generateSecretCode(codeLength, optionsPerDigit);
std::cout << "I have locked the door with a secret Code, you will never be able to figure it out!!" << std::endl; std::cout << "I have locked the door with a secret Code, you will never be able to figure it out!!" << std::endl;
// printAllStringsInVector(SecretCode);
while (livesRemaining) { while (livesRemaining) {
std::vector<std::string> guess = getCodeGuessFromConsole(codeLength, livesRemaining); std::vector<std::string> guess = getCodeGuessFromConsole(codeLength, livesRemaining);