× Go Back Go Back to Programming Section Menu Go Back to Home Page
class_Mastermindv2.h
/****************************************************************************************************/
/*               File Name: Class_Mastermindv2.h               Written by: Koral Eren               */
/****************************************************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <string>

using namespace std;

class Mastermind{
    private:
        string Guess;
        string possibility_array [4536];
        string feedback;
    public:
        static int guess_count;

        Mastermind()
        {
            Guess = "1023";

            initialize_possibility_array();
            fill_possibility_array();

            feedback = "xxxx";

            print_welcome_message();
        }

        ~Mastermind()
        {

        }

        void initialize_possibility_array()
        {
            for (unsigned int i=0; i<4536;i++)
                possibility_array[i] = "xxxx";
        }

        void fill_possibility_array()
        {
            char digit0 = '1', digit1 = '0', digit2 = '2', digit3 ='3';
            bool temp;
            unsigned int i = 0;

            while (true)
            {
                if (digit0 == '9')
                    if (digit1 == '8')
                        if (digit2 == '7')
                            if (digit3 == '7')
                                break;
                temp = true;

                if (digit0 == digit1)
                    temp = false;

                else if (digit0 == digit2)
                    temp = false;

                else if (digit0 == digit3)
                    temp = false;

                else if (digit1 == digit2)
                    temp = false;

                else if (digit1 == digit3)
                    temp = false;

                else if (digit2 == digit3)
                    temp = false;

                if(temp == true)
                {
                    possibility_array[i].at(0) = digit0;
                    possibility_array[i].at(1) = digit1;
                    possibility_array[i].at(2) = digit2;
                    possibility_array[i].at(3) = digit3;
                    i ++;
                }


                if (digit1 == '9' && digit2 == '9' && digit3 == '9')
                {
                    digit1 = '0';
                    digit2 = '0';
                    digit3 = '0';
                    digit0 ++;
                    continue;
                }

                if (digit2 == '9' && digit3 == '9')
                {
                    digit2 = '0';
                    digit3 = '0';
                    digit1 ++;
                    continue;
                }

                if (digit3 == '9')
                {
                    digit3 = '0';
                    digit2 ++;
                    continue;
                }

                digit3 ++;
            }
        }

        void guess()
        {
            srand(time(NULL));

            if (guess_count == 1)
            {
                Guess = possibility_array[rand()%4536];
                cout << "Computer: My " << guess_count << ". guess out of 4536 feasible solution is: " << Guess << endl;
                guess_count++;
            }

            else
            {
                int counter = 0;
                int indice = 0;
                int temp = 0;
                int counter3 = 0;

                for(unsigned int i = 0; i<4536; i++)
                    if (possibility_array[i] != "xxxx")
                        counter ++;

                if (counter == 0)
                {
                    cout << "Computer: There is no feasible solution" << endl;
                    cout << "\nPress [Enter] to exit" << endl;
                    getchar();
                    exit(EXIT_SUCCESS);
                }

                if (counter == 1)
                {
                    unsigned int tmp = 0;

                    for(unsigned int i = 0; i<4536; i++)
                        if (possibility_array[i] != "xxxx")
                            tmp = i;

                    cout << "Computer: I found your code " << possibility_array[tmp] << " in " << guess_count << " guesses. Can you beat me?" << endl;
                    cout << "\nPress [Enter] to exit" << endl;
                    getchar();
                    exit(EXIT_SUCCESS);
                }

                cout << "Computer: There is " << counter << " feasible solution left" << endl;

                cout << "\nHere is a list of possible solutions: " < 4) // Checking for the number of chars
                {
                    cout << "Please Enter a valid feedback\n";
                    continue;
                }

                else if(feedback.find('+') == string::npos &&
                        feedback.find('-') == string::npos &&
                        feedback.length()  != 0)
                {
                    cout << "Please Enter a valid feedback\n";
                    continue;
                }

                break;
            }

            return feedback;
        }

        void update(const string User_feedback)
        {
              if (feedback == "-")
            {
                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] ||
                            possibility_array[i].at(1) == Guess[1] ||
                            possibility_array[i].at(2) == Guess[2] ||
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "--")
            {
                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] ||
                            possibility_array[i].at(1) == Guess[1] ||
                            possibility_array[i].at(2) == Guess[2] ||
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "---")
            {
               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] ||
                            possibility_array[i].at(1) == Guess[1] ||
                            possibility_array[i].at(2) == Guess[2] ||
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "----")
            {
                for(unsigned int i = 0; i<4536; i++)
                    if(possibility_array[i] != "xxxx")
                    {
                        if(possibility_array[i].find(Guess[0]) == string::npos)
                                possibility_array[i] = "xxxx";

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[1]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[2]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[3]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }
                    }

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] ||
                            possibility_array[i].at(1) == Guess[1] ||
                            possibility_array[i].at(2) == Guess[2] ||
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "")
            {
                for(unsigned int i = 0; i<4536; i++)
                    if(possibility_array[i] != "xxxx")
                    {
                        if(possibility_array[i].find(Guess[0]) != string::npos)
                                possibility_array[i] = "xxxx";

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[1]) != string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[2]) != string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[3]) != string::npos)
                                    possibility_array[i] = "xxxx";
                        }
                    }
            }

            else if (feedback == "+")
            {
                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "++")
            {
                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2])
                                possibility_array[i] = "xxxx";

             for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "+++")
            {
                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(2) != Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "+-")
            {
                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] &&
                            possibility_array[i].at(1) == Guess[1])
                                possibility_array[i] = "xxxx";

             for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] &&
                            possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) == Guess[0] &&
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(1) == Guess[1] &&
                            possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(1) == Guess[1] &&
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

            for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(2) == Guess[2] &&
                            possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "+--")
            {
                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "+---")
            {
                for(unsigned int i = 0; i<4536; i++)
                    if(possibility_array[i] != "xxxx")
                    {
                        if(possibility_array[i].find(Guess[0]) == string::npos)
                                possibility_array[i] = "xxxx";

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[1]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[2]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[3]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }
                    }

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

            }

            else if (feedback == "++-")
            {
                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

               for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[1]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[2]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[1]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[2]) == string::npos &&
                           possibility_array[i].find(Guess[3]) == string::npos)
                                possibility_array[i] = "xxxx";

                 for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].find(Guess[0]) != string::npos &&
                           possibility_array[i].find(Guess[1]) != string::npos &&
                           possibility_array[i].find(Guess[2]) != string::npos &&
                           possibility_array[i].find(Guess[3]) != string::npos)
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";
            }

            else if (feedback == "++--")
            {
                for(unsigned int i = 0; i<4536; i++)
                    if(possibility_array[i] != "xxxx")
                    {
                        if(possibility_array[i].find(Guess[0]) == string::npos)
                                possibility_array[i] = "xxxx";

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[1]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[2]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }

                        if(possibility_array[i] != "xxxx")
                        {
                            if(possibility_array[i].find(Guess[3]) == string::npos)
                                    possibility_array[i] = "xxxx";
                        }
                    }

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if (possibility_array[i].at(0) != Guess[0] &&
                            possibility_array[i].at(1) != Guess[1] &&
                            possibility_array[i].at(2) != Guess[2] &&
                            possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) != Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) != Guess[0] &&
                           possibility_array[i].at(1) != Guess[1] &&
                           possibility_array[i].at(2) != Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

                for(unsigned int i = 0; i<4536; i++)
                   if(possibility_array[i] != "xxxx")
                        if(possibility_array[i].at(0) == Guess[0] &&
                           possibility_array[i].at(1) == Guess[1] &&
                           possibility_array[i].at(2) == Guess[2] &&
                           possibility_array[i].at(3) == Guess[3])
                                possibility_array[i] = "xxxx";

            }

            else if(feedback == "++++")
            {
                    guess_count --;
                    cout << "Computer: I found your code " << Guess << " in " << guess_count << " guesses. Can you beat me?" << endl;
                    cout << "\nPress [Enter] to exit" << endl;
                    getchar();
                    exit(EXIT_SUCCESS);
            }

            else
            {
                cout << "Computer: You liar! This is not possible. Rerun the program again and play legit" << endl;
                cout << "\nPress [Enter] to exit" << endl;
                getchar();
                exit(EXIT_SUCCESS);
            }
        }

        void print_welcome_message()
        {
            cout << "Welcome to the Mastermind solver. I solve your code in\n";
            cout << "7 or less steps. Hold a 4 digit code not starting with\n";
            cout << "0. Repeating numbers are not allowed.\n";
            cout << "You have to give feedback to my guess\n";
            cout << "a + means correct position correct number\n";
            cout << "a - means wrong position correct number\n";
            cout << "Possible feedback is as follows:\n";
            cout << "[ ]\n";
            cout << "[-]\n";
            cout << "[--]\n";
            cout << "[---]\n";
            cout << "[----]\n";
            cout << "[+]\n";
            cout << "[++]\n";
            cout << "[+++]\n";
            cout << "[+-]\n";
            cout << "[+--]\n";
            cout << "[+---]\n";
            cout << "[++-]\n";
            cout << "[++--]\n";
            cout << "[++++]\n";
            cout << "\nGood luck!\n" << endl;
        }
};

main.cpp
/****************************************************************************************/
/*               File Name: main.cpp               Written by: Koral Eren               */
/****************************************************************************************/
#include <iostream>

#include "class_Mastermindv2.h"

using namespace std;


int Mastermind::guess_count = 1;

int main()
{
    Mastermind mas;

    while (Mastermind::guess_count <= 10)
    {
        mas.guess();
        mas.update(mas.get_feedback());
    }

    cout << "\nPress [enter] to exit game...";
    getchar();

    return 0;
}