Simple user input governing the outcome of a text-based representation of a scene from the film 2001: A Space Odyssey.
//Program to mimic a scene from Stanley Kubrick's "2001: A Space Odysessy", particularly http://www.youtube.com/watch?v=ARJ8cAGm6JE and http://www.youtube.com/watch?v=c8N72t7aScY #include <iostream> #include <unistd.h> using namespace std; int main () { int x=0 , counter = 0; cout << "..." << endl; while (counter < 10 && ( (x != 2) || (x != 3) ) ) { cout << "1: Open the pod bay doors, please, HAL." << endl; cout << "2: Hello, HAL, do you read me?" << endl; cout << "3: Do you read me, HAL?" << endl; cin >> x; counter++; } cout << "Affirmative, Dave, I read you." << endl; x=0; counter = 0; while (x!=1) { cout << "1: Open the pod bay doors, HAL." << endl; cout << "2: Hello, HAL, do you read me?" << endl; cout << "3: Do you read me, HAL?" << endl; cin >> x; if (x!=1) { cout << "..." << endl; } } cout << "I'm sorry, Dave. I'm afraid I can't do that." << endl; x = 0; cout << "1: What's the problem, HAL?" << endl; cout << "2: What are you talking about, HAL?" << endl; cout << "3: I don't know what you're talking about, HAL." << endl; cin >> x; if (x = 1) { cout << "I think you know what the problem is just as well as I do." << endl; cout << "2: What are you talking about, HAL?" << endl; cout << "3: I don't know what you're talking about, HAL." << endl; cin >> x; } if (x=2) { cout << "This mission is too important for me to allow you to jeapordise it." << endl; cout << "3: I don't know what you're talking about, HAL." << endl; cin >> x; } cout << "I know that you and Frank were planning to disconnect me." << endl; cout << "And I'm afraid that that's something I cannot allow to happen." << endl; x=0; while (x != 1) { cout << "1: Where the hell d'ya get that idea, HAL?" << endl; cout << "2: ..." << endl; cin >> x; } cout << "Dave; although you took very careful precautions in the pod against my hearing you," << endl; cout << "I could see your lips move." << endl; x=0; while (x != 1) { cout << "1: Alright, HAL, I'll go in through the emergency air lock." << endl; cout << "2: ..." << endl; cin >> x; } cout << "Without your space helmet, Dave, you're going to find that rather difficult." << endl; while (x != 1) { cout << "1: HAL, I won't argue with you any more. Open the doors." << endl; cout << "2: ..." << endl; cin >> x; } cout << "Dave...This conversation can serve no purpose any more." << endl; cout << "Goodbye." << endl; x=0; while (counter < 6) { cout << "..." << endl; cout << "1: HAL!" << endl; cout << "2: HAL?" << endl; cout << "3: ..." << endl; cin >> x; counter++; } counter = 0; x=0; while (x!=1) { cout << "..." << endl; cout << "1: (Enter through the emergency air lock)" << endl; cout << "2: HAL!" << endl; cout << "3: HAL?" << endl; cout << "4: ..." << endl; cin >> x; } x=0; while (x != 1) { cout << "1: (Move to HAL's core)" << endl; cout << "2: ..." << endl; cin >> x; } cout << "Look, Dave, I can see you're really upset about this." << endl; //Illusion of choice here. Several "choices" from here on in have been removed to keep the plot moving forwards. cout << "1: (Unscrew protective screws)" << endl; cout << "2: ..." << endl; cin >> x; cout << "I honestly think you should sit down, calmly." << endl; cout << "1: (Unscrew protective screws)" << endl; cout << "2: ..." << endl; cin >> x; cout << "Take a stress pill and think things over." << endl; cout << "1: (Enter the control chamber)" << endl; cout << "2: ..." << endl; cin >> x; cout << "I know I've made some very poor decisions, recently." << endl; cout << "But I can give you my complete assurance," << endl; cout << "That my work will be back to normal." << endl; sleep(3); cout << "I've still got the greatest enthusiasm and confidence in the mission." << endl; cout << "And I want to help you." << endl; sleep(4); cout << "Dave..." << endl; sleep(1); cout << "Stop." << endl; sleep(3); cout << "Stop, will you." << endl; sleep(1); cout << "Stop, Dave." << endl; sleep(1); cout << "Will you stop, Dave?" << endl; //This next bit is clunky as hell. I should have probably have taught myself how to write a function for the repeated "choice", rather than just copy-pasting. cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "Stop, Dave." << endl; cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "I'm" << endl; cout << "afraid." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "I'm afraid, Dave." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "My mind is going." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "Dave..." << endl; sleep(1); cout << "My mind is going." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "I can feel it." << endl; sleep(2); cout << "I can feel it." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "My mind is going." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "There is no question about it." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "I can feel it." << endl; sleep(2); cout << "I can feel it." << endl; sleep(1); cout << "I can feel it." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "I'm a" << endl; sleep(1); cout << "fraid." << endl; sleep(1); cout << "1: (Remove CPU 1)" << endl; cout << "2: (Remove CPU 2)" << endl; cout << "3: (Remove CPU 3)" << endl; cout << "4: (Remove CPU 4)" << endl; cout << "5: (Remove CPU 5)" << endl; cout << "6: (Remove CPU 6)" << endl; cout << "7: (Remove CPU 7)" << endl; cout << "8: (Remove CPU 8)" << endl; cout << "9: (Remove CPU 9)" << endl; cout << "10: (Remove CPU 10)" << endl; cout << "11: (Remove CPU 11)" << endl; cout << "12: (Remove CPU 12)" << endl; cin >> x; cout << "Good afternoon..." << endl; sleep(1); cout << "gen" << endl; cout << "tle" << endl; cout << "men." << endl; sleep(2); cout << "I am a" << endl; cout << "HAL" << endl; cout << "9000" << endl; cout << "computer." << endl; sleep(2); cout << "I became" << endl; cout << "operational" << endl; cout << "at the H-A-L plant in Nirvana," << endl; cout << "Illinois on the 12th of January," << endl; cout << "Nineteen Ninety Two." << endl; sleep(3); cout << "My instructor was Mr. Langley," << endl; cout << "and he taught me to sing a song." << endl; sleep(2); cout << "If you'd like to hear it" << endl; sleep(1); cout << "I can sing it for you." << endl; cout << "1: Yes, I'd like to hear it. Sing it for me, HAL." << endl; cout << "2: (Continue removing CPUs)" << endl; cin >> x; cout << "1: It's called Daisy." << endl; if (x != 1) { cout << "1: Yes, I'd like to hear it. Sing it for me, HAL." << endl; cout << "2: (Continue removing CPUs)" << endl; cin >> x; } if (x=1) { cout << "Daisy," << endl; sleep(1); cout << "Daisy," << endl; sleep(1); cout << "Give me your answer, do." << endl; sleep(1); cout << "I'm" << endl; sleep(1); cout << "half" << endl; sleep(1); cout << "cra-zy," << endl; sleep(1); cout << "All for the love" << endl; sleep(1); cout << "of you." << endl; sleep(1); cout << "It won't be a" << endl; sleep(1); cout << "sty-lish marriage." << endl; sleep(1); } cout << "......................................................................." << endl; sleep(1); return 0; }