Question: I need a C++ code that cracks the 4 digit code in a source code. please read the following for a referencePrompt: Mastermind with an AIGuidelines 4 digit code breaking 0000-9999Use my Driver/Stub to write your own AI function.Create your AI function whose output is the next guess to break the code.Include writeup/flowcharts/pseudocode,You should be able to break the code faster than a Binary Search.Code mentioned in prompt: There are two versions you can use. Link: 2021_Spring_CSC_CIS_7/main.cpp at master · ml1150258/2021_Spring_CSC_CIS_7 · GitHubunder project MasterMindAI_V1 or V2.Source Code to Copy: V2 here//System Libraries #include #include #include #include #include using namespace std; //Function Prototypes string AI(char,char); bool eval(string,string,char &,char &); string set(); int main(int argc, char** argv) { //Set the random number seed srand(static_cast(time(0))); //Declare variables string code,guess; //code to break, and current guess char rr,rw; //right digit in right place vs. wrong place int nGuess; //number of guesses //Initialize Values nGuess=0; code=set(); rr=rw=0; //Loop until solved and count to find solution do{ nGuess++; guess=AI(rr,rw); }while(eval(code,guess,rr,rw)); //Check evaluation cout<(rr) <(rw)<(r[i])<<" " <(w[i])<0?guess-10:0,guess); //Calculate the guess int n1000=(guess-guess%1000)/1000; int n100=(guess-guess%100)/100-10*n1000; int n10=(guess%100-guess%10)/10; int n1=guess%10; sGuess[0]=n1000+'0'; sGuess[1]=n100+'0'; sGuess[2]=n10+'0'; sGuess[3]=n1+'0'; aGuess[++guess]=sGuess;//Save the result //Return the result return sGuess; } bool eval(string code,string guess,char &rr,char &rw){ string check=" "; rr=0,rw=0; //Check how many are right place for(int i=0;iSample output: Currently it will generate a 4 digit code and display how many guess it took, the actual code, and the code the AI guessed.Ex: 5237 5236 52365226 3 0 <- this output shows the current guess and how many digits are correct5227 2 0I need it to displayEx: 13or less 5236 5236Last info: Basically I need an AI code in V2 to be altered in a way that will allow the computer to guess the randomly generated code with 13 guesses. In addition I need a simple flowchart and a psuedocode for it aswell. Not looking for amazing work. Just something that works.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more