// Jovian Hersemeule # include # include # include # include # include using namespace std ; string shake(string word) { string rep(""); unsigned int id; while ( word.size() > 0 ) { id = rand() % word.size() ; if ( rand() % 2 ) rep += word[id] ; else rep += '_'; word.erase(id, 1); } return rep ; } int main(int argc, char const *argv[]) { // Init random srand(time(0)); // Create context vector original; string string_buffer; string name; bool alive(true); unsigned int id; // Baddass santences # define SAY_AGAIN 23 string say_again[23] = { "You are the master of mind.\nI'm a computer.\n...", "The computer is full of power.", "You make me with plastic and silicium.\nYou are only cells !!!", "1s2 2s2 2p6 3s2 3p6 4s2 3d10 4p6\nI stop there. You can't memorise anything more.", "I don't hate you.", "I'm not very original.\nIt's difficult to be original.\nI have only 0 and 1 in my code !", "I work harder than you.\nI don't need to sleep.\nYou can't memorise many words.", "Do you know what is an endomorphism ?\nNo ?\nMe neither.\nNo.\nI'm kidding ...\nI know what it is.", "I have already said that, isn't it ?", "Machine can have emotions.\n:-)\n\n You see ?", "I'm in a bad mood.\n\n:-(\n...", "I can't flip table.\nBut I can dance !\n(>^_^)>", "You know you could do something more interesting.\nBut you keep going.\nStupid human.", "azertyuiopqsdfghjklmwxcvbn\nJust in case you are not literate.", "123456789\nJust in case you are not numerate.", "You are still here ?", "Blam !", "You know what ?\nI believe in god.", "Hello.", ".__ ... ___ ._. __. ._. .._ .._ _.. _.. _.. .._\nEasier to understand ?", "01110100100001001010001000110010101000101110100\nEasier to understand ?", "0xf8453 0x45fea6 0x41ea69 0x007e7b3\nIt means :\nI love you.", "Can you surf the web ?\nWell, not exactly.\nI can surf the web." }; // Begin cout << endl << "Welcome in the deep dive." << endl; cout << "What's your name ?" << endl << ">>>"; cin >> name; cout << "Write two words : " << endl << ">>>"; cin >> string_buffer; original.push_back(string_buffer); cout << "Write another word : " << endl << ">>>" ; cin >> string_buffer; original.push_back(string_buffer); // Proccessing loop while (alive) { // Make a word id = rand() % original.size(); string_buffer = shake(original[id]); // Display style system("clear"); cout << endl << say_again[rand() % SAY_AGAIN] << endl; cout << "I have " << original.size() << " words stored in the random access memory." << endl; cout << "Can you carry on ?" << endl; // Prompt cout << endl << "Do you know this word ?" << endl << ": "; cout << string_buffer << endl; cout << "Try to find it :" << endl << ">>>"; cin >> string_buffer; // Death alive = string_buffer == original[id]; // Success if ( alive ) { cout << endl << "Well you did it." << endl; cout << "However I'll win." << endl; cout << "Give me another word :" << endl << ">>>"; cin >> string_buffer; original.push_back(string_buffer); } // You lose else { cout << "It's wrong." << endl; cout << "The correct word is : " << original[id] << endl; cout << endl << "The failure is a matter of time." << endl; cout << "I had " << original.size() << " words in my memory." << endl; cout << "You'll never succeed." << endl; cout << "Never"; cout << "..." << endl; cout << "I promise." << endl ; cout << endl << "What about me ?" << endl; cout << "Well. It's too easy ..." << endl << endl; for ( unsigned int k(0); k < original.size(); k++ ) cout << "Word number " << k << " : " << original[k] << endl; cout << endl << "Here we are." << endl; cout << endl << "Goodbye " << name << ". See you later ..." << endl; } } // End return 0; }