Question: a C++ code that cracks the 4 digit code in a source code.
please read the following for a reference
Prompt: Mastermind with an AI
Guidelines 4 digit code breaking 0000-9999
Use 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 · GitHub
under 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;i
Sample 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 5236
5226 3 0 <- this output shows the current guess and how many digits are correct
5227 2 0
I need it to display
Ex: 13or less 5236 5236
Last 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.
GET SOLUTION BELOW
TO BE RE-WRITTEN FROM THE SCRATCH
- Original and non-plagiarized custom papers. Our writers develop their writing from scratch unless you request them to rewrite, edit or proofread your paper.
- Timely Delivery. capitalessaywriting.com believes in beating the deadlines that our customers have imposed because we understand how important it is.
- Customer satisfaction. Customer satisfaction. We have an outstanding customer care team that is always ready and willing to listen to you, collect your instructions and make sure that your custom writing needs are satisfied
- Privacy and safety. It’s secure to place an order at capitalessaywriting.com We won’t reveal your private information to anyone else.
- Writing services provided by experts. Looking for expert essay writers, thesis and dissertation writers, personal statement writers, or writers to provide any other kind of custom writing service?
- Enjoy our bonus services. You can make a free inquiry before placing and your order and paying this way, you know just how much you will pay. a C++ code that cracks the 4 digit code in a source code.
- Premium papers. We provide the highest quality papers in the writing industry. Our company only employs specialized professional writers who take pride in satisfying the needs of our huge client base by offering them premium writing services.