// // Created by DH10MBO on 13.11.2024. // #include "Mastermind.h" #include #include #include #include "../Aufg4/CrimeStats.h" int getRandomNumberInRange(int min, int max) { static std::mt19937 generator(static_cast(time(nullptr))); std::uniform_int_distribution distribution(min, max); int randomNumber = distribution(generator); return randomNumber; } void printAllStringsInVector(std::vector &strings) { std::cout << "["; int i; for (i = 0; i < strings.size() - 1; i++) { std::cout << strings[i] << ", "; } std::cout << strings[i] << "]" << std::endl; } std::vector generateSecretCode(int digits, int optionsPerDigit) { std::vector secretCode; for (int i = 0; i < digits; i++) { int digit = getRandomNumberInRange(0, optionsPerDigit); secretCode.push_back(std::to_string(digit)); std::cout << "Secret Code was set as " << digit << std::endl; } return secretCode; } std::vector getCodeGuessFromConsole() { std::cout << "Have a Guess! :" << std::endl; std::string input; std::cin >> input; std::vector guess; split(input, ' ', guess); return guess; } void Aufg5Main() { // generateSecretCode(1,1); std::vector SecretCode = generateSecretCode(4, 4); printAllStringsInVector(SecretCode); std::vector guess = getCodeGuessFromConsole(); printAllStringsInVector(guess); }