#include #include "GameConstants.h" #include "PersonT.h" using namespace std; PersonT::PersonT(){ age = 0; } string PersonT::Name(){ return name; } void PersonT::Name(string n){ name = n; } int PersonT::Age(){ return age; } void PersonT::Age(int a){ age = a; } int PersonT::CherriesInBucket(){ return bucket.GetCherryCount(); } void PersonT::MoveCherries(int n) { string dest = "tree"; if (n > 0) { dest = "bucket"; } cout << "\tAdding " << abs(n); if (n == 1) { cout << " cherry"; } else { cout << " cherries"; } cout << " to the " << dest << "." << endl; bucket.AddCherries(n); return; } void PersonT::TakeTurn(SpinnerT & spinner){ spinner.Spin(); cout << "\tI spun a " << spinner.GetResultString() << "." << endl; switch (spinner.GetResult()) { case ONE_CHERRY: MoveCherries(1); break; case TWO_CHERRIES: MoveCherries(2); break; case THREE_CHERRIES: MoveCherries(3); break; case FOUR_CHERRIES: MoveCherries(4); break; case BIRD: case DOG: MoveCherries(-2); break; case SPILL: cout << "\tPutting all cherries back on the tree" << endl; bucket.Dump(); break; default: cout << "I don't know what to do" << endl; } cout << "\tThe bucket now has " << bucket.GetCherryCount() << " cherries." << endl; cout <<"\tThe tree now has " << MAX_CHERRIES - bucket.GetCherryCount() << " cherries." << endl; if (bucket.GetCherryCount() == MAX_CHERRIES){ cout << "\t Hi-Ho Cherry-O!" << endl; } }