//******************************************************************************************** // int checkIfAtPlanetMenu() // This method is used when you get to a planet to generate the buy and sell option // as of right now the planet.getPlanetName() is giving errors so it is left blank //******************************************************************************************** int checkIfAtPlanetMenu(ship &s,planet &p) { int input = 0; system("cls"); cout << "Welcome to --Fix Planet Name--... " << "Planet Description goes here?? Maybe?." << endl << endl; cout << "\nIron: " << p.getIronQuantity() << endl; cout << "\nSugar: " << p.getSugarQuantity() << endl; cout << "\nRice: " << p.getRiceQuantity() << endl; cout << "\nFuel: " << p.getFuel() << endl; cout << "1. Buy Iron: " << endl; cout << "2. Buy Sugar: " << endl; cout << "3. Buy Rice: " << endl; cout << "4. Sell Iron: " << endl; cout << "5. Sell Sugar: " << endl; cout << "6. Sell Rice: " << endl; cout << "7. Buy Fuel: " << endl; cout << "8. Exit planet" << endl; cout << "You have " << "Rice - " << s.getRice() << " Iron - " << s.getIron() << " Sugar - " << s.getSugar() << endl; cout << "SpaceBucks - " << s.getFunds() << " Fuel - " << s.getFuel() << " Cargo Max - " << s.getCARGO_MAX() << endl; cout << "What do you want to do?"; cin >> input; return input; }
void eating(planet &first_one, planet &sec_one) { if((first_one.Radius+sec_one.Radius)>=first_one.distance(sec_one)) if(sec_one.Radius>=first_one.Radius){ //momentum function ( MV (totol) = M1v + M2v _) sec_one.velocity_x=(first_one.velocity_x* pow(first_one.Radius,3)+sec_one.velocity_x*pow(sec_one.Radius,3))/(pow(sec_one.Radius,3)); sec_one.velocity_y=(first_one.velocity_y* pow(first_one.Radius,3)+sec_one.velocity_y*pow(sec_one.Radius,3))/(pow(sec_one.Radius,3)); sec_one.Radius+=first_one.Radius/4; // increase 1/4 radiius from smaller one first_one=planet(-1,-1,0,0,0,0); //mark radius equal to 0 , then we delete it in big_bang } else{ //momentum function ( MV (totol) = M1v + M2v _) first_one.velocity_x=(sec_one.velocity_x* pow(sec_one.Radius,3)+first_one.velocity_x*pow(first_one.Radius,3))/(pow(first_one.Radius,3)); first_one.velocity_y=(sec_one.velocity_y* pow(sec_one.Radius,3)+first_one.velocity_y*pow(first_one.Radius,3))/(pow(first_one.Radius,3)); first_one.Radius+=sec_one.Radius/4; // increase 1/4 radiius from smaller one sec_one=planet(-1,-1,0,0,0,0); //mark radius equal to 0 , then we delete it in big_bang } }
double light (planet p){ return p.get_miles()/186000; }
//******************************************************************************************** // int moveMoon() // This method is used to run a counter that makes the moon orbit earth every couple of turns. // //******************************************************************************************** void moveMoon(planet &m) { static int moonCounter; // counter to move the moon; moonCounter++; switch (moonCounter) { case 5: // move moon right (1) space m.setX(m.getX()+1); break; case 10: // move moon right (1) space m.setX(m.getX()+1); break; case 15: // move moon up (1) space m.setY(m.getY()-1); break; case 20: // move moon up (1) space m.setY(m.getY()-1); break; case 25: // move moon up (1) space m.setY(m.getY()-1); break; case 30: // move moon up (1) space m.setY(m.getY()-1); break; case 35: // move moon left (-1) space m.setX(m.getX()-1); break; case 40: // move moon left (-1) space m.setX(m.getX()-1); break; case 45: // move moon left (-1) space m.setX(m.getX()-1); break; case 50: // move moon left (-1) space m.setX(m.getX()-1); break; case 55: // move moon up (1) space m.setY(m.getY()+1); break; case 60: // move moon up (1) space m.setY(m.getY()+1); break; case 65: // move moon up (1) space m.setY(m.getY()+1); break; case 70: // move moon up (1) space m.setY(m.getY()+1); break; case 75: // move moon right (1) space m.setX(m.getX()+1); break; case 80: // move moon right (1) space m.setX(m.getX()+1); moonCounter=0; break; default: ; } }
//*********************************************************************************** // void checkIfAtPlanet() // This fucntion checks to see if you have arrived at a planet, then it'd put you // in the store. // //********************************************************************************** void checkIfAtPlanet(ship &s,planet &jupiter,planet &earth,planet &mars,planet &ganymede,planet &moon,planet &saturn,planet &neptune,planet &pluto,planet &ceres) { short input = 0; //********************************************************************************** // 1. Jupiter //********************************************************************************** if (s.getX()==jupiter.getX() && s.getY()==jupiter.getY()) { jupiter.Shop(s); } // end of jupiter if //********************************************************************************** // 2. Earth //********************************************************************************** if (s.getX()==earth.getX() && s.getY()==earth.getY()) { earth.Shop(s); } // end of earth if //********************************************************************************** // 3. Mars //********************************************************************************** if (s.getX()==mars.getX() && s.getY()==mars.getY()) { mars.Shop(s); } // end of mars if //********************************************************************************** // 4. Ganymede //********************************************************************************** if (s.getX()==ganymede.getX() && s.getY()==ganymede.getY()) { ganymede.Shop(s); } //********************************************************************************** // 5. Saturn //********************************************************************************** if (s.getX()==saturn.getX() && s.getY()==saturn.getY()) { saturn.Shop(s); } //********************************************************************************** // 6. Pluto //********************************************************************************** if (s.getX()==pluto.getX() && s.getY()==pluto.getY()) { pluto.Shop(s); } //********************************************************************************** // 7. Ceres //********************************************************************************** if (s.getX()==ceres.getX() && s.getY()==ceres.getY()) { ceres.Shop(s); } //********************************************************************************** // 8. Neptune //********************************************************************************** if (s.getX()==neptune.getX() && s.getY()==neptune.getY()) { neptune.Shop(s); } //********************************************************************************** // 9. Moon -- different from planet //********************************************************************************** if (s.getX()==moon.getX() && s.getY()==moon.getY()) { do { // begin do loop input = checkIfAtMoonMenu(s,jupiter,earth,mars,ganymede,moon,saturn,neptune,pluto,ceres); cout << "1. Check Mail Box: -- Not Functional... " << endl; cout << "2. Repair Ship: -- Not Functional... " << endl; cout << "3. Upgrade Ship: -- Not Functional... " << endl; cout << "4. Pick Up Passengers: -- Not Functional... " << endl; cout << "5. Talk to people listen to space news... -- not functional... " << endl; switch(input) { case 1: system("cls"); //checkMailBox(); cout << "N/A" << endl; break; case 2: system("cls"); //repairShip(); cout << "N/A" << endl; break; case 3: system("cls"); //upgradeShip(); cout << "N/A" << endl; break; case 4: system("cls"); //pickUpPassengers(); cout << "N/A" << endl; break; case 5: system("cls"); //talkToPeople(); cout << "N/A" << endl; break; case 6: system("cls"); cout << "Take Care out there in space..." << endl; break; default: cout << "You can only choose option 1-5 are not programmed, nothing else is programmed... " << endl; break; }// end of switch } // end of do while (input == 1 || input == 2 || input == 3 || input == 4 || input == 5); s.setX(s.getX()+1); s.setY(s.getY()+1); } s.setX(s.getX()+1); } // end of method
double light(planet pl) { double dist = pl.get_miles(); return dist / 186000; }