#include using namespace std; #define NUMTESTS 3 #define NUMTRIPS 10 //wrong tests: //1: n, n+2, n+4 //2: n, 2n, 3n //3: n, n+a, n+2a class triplet { public: triplet (int, int, int); void test (); void display (); void quiz (int [NUMTESTS+1]); private: bool awesome; bool uawesome; int n1; int n2; int n3; bool mywrongtests [NUMTESTS]; }; triplet::triplet (int N1, int N2, int N3) { n1=N1; n2=N2; n3=N3; awesome = (n1> input; uawesome = (input == 'y'); for (int i = 1; i< NUMTESTS+1; i++) if (uawesome != mywrongtests[i]) errors[i]++; if (uawesome != awesome) errors[0]++; cout << endl; } int main () { cout << "Hi there! We're going to play a game based on a classic cognitive science experiment first performed by Peter Wason in 1960 (references at the end)" << endl << endl; cout << "Here's how it works. I'm thinking of a rule which separates sequences of three numbers into 'awesome' triplets, and not-so-awesome triplets. "; cout << "I'll tell you for free that 2 4 6 is an awesome triplet. " << endl << endl; cout << "What you need to do is to figure out which rule I'm thinking of. To help you do that, I'm going to let you experiment for a bit. "; cout << "Enter any three numbers, and I'll tell you whether they are awesome or not. You can do this as many times as you like, so please take your time." << endl << endl; cout << "When you're sure you know what the rule is, just enter 0 0 0, and I'll test you to see if you've correctly worked out what the rule is." << endl << endl; int n1, n2, n3; bool ndone = (1==1); while (ndone) { cout << "Enter three numbers separated by spaces: "; cin >> n1 >> n2 >> n3; cout << endl; if (n1 == 0 && n2 == 0 && n3 == 0) ndone = (0==1); else { triplet bob (n1, n2, n3); bob.test(); } } cout << "So, you're pretty sure what the rule is now? Cool. I'm going to give you some sets of numbers, and you can tell me whether they seem awesome to you or not." << endl; triplet *trips[NUMTRIPS]; trips[0]=new triplet(3,6,9); trips[1]=new triplet(6,4,2); trips[2]=new triplet(8,10,12); trips[3]=new triplet(1,17,33); trips[4]=new triplet(18,9,0); trips[5]=new triplet(1,7,3); trips[6]=new triplet(3,5,7); trips[7]=new triplet(2,9,15); trips[8]=new triplet(5,10,15); trips[9]=new triplet(3,1,4); trips[10]=new triplet(5,5,5); int errors[NUMTESTS+1]; for (int j = 0;jquiz(errors); for (int i = 0;idisplay(); delete trips[i]; } if (errors[0] == 0) { cout << "Congratulations! You have performed perfectly on this test, having discovered the correct rule: awesome triplets are simply triplets in which each number is greater than the previous one. "; cout << "It may surprise you to know this, but in tests carried out by Peter Wason, only 20% of subjects performed as well as you have." << endl; } else { int bestscore=20; int besttest=0; for (int k = 0;k= 3) cout << "It looks like you didn't find any rule at all." << endl << endl; else if (besttest == 0) { cout << "It looks like you have discovered the correct rule, though you made " << bestscore << "errors." << endl << endl; } else { if (besttest == 1) cout << "It looks like you thought the rule was that awesome triplets contain numbers which increase by 2. "; else if (besttest == 2) cout << "It looks as though you thought the rule was that awesome triplets contained three successive multiples of the same number, like 3,6,9, or 6,12,18. "; else if (besttest == 3) cout << "It looks as though you thought the rule was that awesome triplets contain numbers separated by the same interval. "; cout << "In fact, awesome triplets are simply triplets in which each number is greater than the previous one." << endl << endl; cout << "The rule for awesomeness was a fairly simple one, but you invented a more complicated, more specific rule, which happened to fit the first triplet you saw. "; cout << "In experimental tests, it has been found that 80% of subjects do just this, and then never test any of the pairs that *don't* fit their rule. "; cout << "If they did, they would immediately see the more general rule that was applying. This is a case of what psychologists call 'positive bias'. "; cout << "It is one of the many biases, or fundamental errors, which beset the human mind. " <