Solving algorithm for a simple problem
- by maolo
I'm searching for an algorithm (should be rather simple for you guys) that does nothing but solve the chicken or the egg problem.
I need to implement this in C++. What I've got so far is:
enum ChickenOrEgg
{
Chicken, Egg
};
ChickenOrEgg WhatWasFirst( )
{
ChickenOrEgg ret;
// magic happens here
return ret;
}
// testing
#include <iostream>
using namespace std;
if ( WhatWasFirst( ) == Chicken )
{
cout << "The chicken was first.";
} else {
cout << "The egg was first.";
}
cout << endl;
Question:
How could the pseudocode for the solving function look?
Notes:
This is not a joke, not even a bad one.
Before you close this, think of why this isn't a perfectly valid question according to the SO rules.
If someone here can actually implement an algorithm solving the problem he gets $500 in cookies from me (that's a hell lot of cookies!).
Please don't tell me that this is my homework, what teacher would ever give his students homework like that?