Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dj;
- import java.util.ArrayList;
- import java.util.Random;
- /**
- * @author Pluto
- */
- public class Surroundings {
- //Stores a list of the women you find around you.
- ArrayList<Woman> nearbyWomen = new ArrayList<>();
- //Global random generator, never know what you find when you get out.
- Random r = new Random();
- //Takes parameters of number of women, personal career.
- Surroundings(int women, Career c) {
- for (int i = 0; i < women; i++) {
- nearbyWomen.add(new Woman(r));
- }
- //Does it matter what you are?
- switch (c) {
- case DOCTOR:
- runGame(8);
- break;
- case LAWYER:
- runGame(10);
- break;
- case ELECTRICALENGINEER:
- runGame(5);
- break;
- case GARBAGECOLLECTOR:
- runGame(-5);
- break;
- case MCDONALDS:
- runGame(-8);
- break;
- case GROCERYSTORE:
- runGame(-3);
- break;
- case PROGRAMMER:
- runGame(5);
- break;
- }
- }
- private void runGame(int bonus) {
- for (int i = 0; i < nearbyWomen.size(); i++) {
- Woman w = nearbyWomen.get(i);
- //In other words... career only matters if she's a gold digger.
- if (w.isGoldDigger() && w.flirt(r) > (75 - bonus)) {
- close();
- } else if (w.flirt(r) > 75) {
- close();
- } else {
- continue;
- }
- }
- }
- private void close() {
- Runtime.getRuntime().exit(0);
- }
- }
- //Generic woman class - plenty of them around, eh?
- class Woman {
- double rating;
- int personality;
- int fickleness;
- boolean goldDigger;
- Woman(Random r) {
- //nextDouble() returns 0 to 1, we want 0 to 10.
- rating = r.nextDouble() * 10;
- personality = r.nextInt(100);
- fickleness = r.nextInt(100);
- goldDigger = r.nextBoolean();
- }
- //Returns the hotness rating of the girl.
- double getRating() {
- return rating;
- }
- //Returns the girl's personality level.
- int getPersonality() {
- return personality;
- }
- int getFickleness() {
- return fickleness;
- }
- boolean isGoldDigger() {
- return goldDigger;
- }
- //Returns the success chance of the flirt.
- //Success depends on the fickleness of a girl.
- int flirt(Random r) {
- return (r.nextInt(100) - fickleness);
- }
- }
- //Various careers that you might have.
- enum Career {
- LAWYER,
- DOCTOR,
- ELECTRICALENGINEER,
- GARBAGECOLLECTOR,
- MCDONALDS,
- GROCERYSTORE,
- PROGRAMMER;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement