#include <iostream>
using namespace std;
int stones;
void turn();
void i_take( int i_took );
int main( int argc, char **argv )
{
cout << "Numo is a game in which one player chooses a finite amount"
<< "stones to place in a pile. The second player then chooses who will"
<< " go first in removing 1, 2, or 3 stones from the pile. If a users "
<< "turn begins with only one stone in the pile the loose not only the"
<< "the game but at life as well." << endl << endl << endl;
cout << "Please submit the amount of stones to be added to the pile..."
<< endl;
cin >> stones;
if ( ( stones - 5 ) % 4 != 0 )
i_take( ( stones - 5 ) % 4 );
while ( stones > 1 )
{
turn();
}
cout << "I am so sorry for your loss. It is your turn and you have only one stone." << endl;
}
void turn( )
{
int you_took;
cout << "It is your turn. How many stones would you like to remove?"
<< endl;
cin >> you_took;
if ( you_took < 0 || you_took > 3 )
{
cout << "You can only remove 1, 2, or 3 stones" << endl;
return;
}
stones -= you_took;
cout << "You removed " << you_took << " stones. " << stones << " remain." << endl << endl << endl;
i_take( 4 - you_took );
}
void i_take( int i_took )
{
stones -= i_took;
cout << "I removed " << i_took << " stones. " << stones << " remain." << endl << endl << endl;
}