Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arcen;
- import java.util.Random;
- /**
- * @author Pluto
- */
- public class ArcenGames {
- //Global random generator, never know what you find when you get out.
- Random r = new Random();
- ArcenGames() {
- for (Game g : Game.values()) {
- Keith keith = new Keith(r);
- for (int hour = 9; hour < 17; hour++) {
- switch (g) {
- case AI_WAR:
- if (!g.getGameKilled()) {
- AIWar a = new AIWar();
- int weight = r.nextInt(100);
- if (weight > 80) {
- keith.addPain(a);
- } else if (weight <= 80 && weight > 5) {
- keith.fixBugs(a);
- } else if (weight <= 5 && weight > 0) {
- keith.addToExpansion(a);
- } else {
- //He killed it.
- g.setGameKilled(true);
- close();
- }
- }
- break;
- case A_VALLEY_WITHOUT_WIND:
- if (!g.getGameKilled()) {
- keith.idunknowwhatthisgamereallyis(10);
- }
- break;
- case TIDALIS:
- if (!g.getGameKilled()) {
- keith.ialsodontknowwhatsinthisgame();
- }
- break;
- }
- }
- }
- }
- private void close() {
- Runtime.getRuntime().exit(0);
- }
- }
- //Arcen's games.
- class Keith {
- //Keith is a person. Person's have health. Some people are healthy. Some people are not.
- double health;
- //Keith has feelings! Though sometimes I wonder...
- double feelings;
- //Keith is fickle. Very very fickle.
- double fickleness;
- //Keith has a work load. This is part of having a job.
- double workLoad;
- Random r;
- Keith(Random r) {
- health = r.nextDouble();
- feelings = r.nextDouble();
- fickleness = r.nextDouble();
- workLoad = r.nextDouble();
- this.r = r;
- }
- double getHealth() {
- return health;
- }
- double getFeelings() {
- return feelings;
- }
- double getFickleness() {
- return fickleness;
- }
- double getWorkLoad() {
- return workLoad;
- }
- /**
- * This should be self explanatory.
- */
- void idunknowwhatthisgamereallyis(int i) {
- //umm, what?
- throw new UnsupportedOperationException("Not yet implemented");
- }
- /**
- * This should also be self explanatory.
- */
- void ialsodontknowwhatsinthisgame() {
- //yeah, above.
- throw new UnsupportedOperationException("Not yet implemented");
- }
- /**
- * Keith adds something to make AI War more painful.
- *
- * @param a
- */
- void addPain(AIWar a) {
- if (this.works()) {
- //No limit in the pain threshold.
- a.setPainThreshold(a.getPainThreshold() + 1);
- }
- }
- /**
- * Keith fixes bugs inherent in AI war.
- *
- * @param a
- */
- void fixBugs(AIWar a) {
- if (this.works()) {
- //Constantly fix bugs.
- if (a.getNumBugs() > 0) {
- a.setNumBugs(a.getNumBugs() - 1);
- } else {
- //... but if they all get fixed, inevitably more have creeped in.
- a.setNumBugs(7);
- }
- }
- }
- /**
- * Keith adds to the expansion progress of AI war.
- *
- * @param a
- */
- void addToExpansion(AIWar a) {
- if (this.works()) {
- //Still working towards the next expansion!
- if (a.getExpansionProgress() < 100) {
- a.setExpansionProgress(a.getExpansionProgress() + 1);
- } else {
- //And if it's finished, there's always a new one to start.
- a.setExpansionProgress(0);
- }
- }
- }
- /**
- * Simple determination of whether Keith gets work done.
- *
- * @return Whether Keith works.
- */
- private boolean works() {
- if (workLoad <= .4) {
- //Keith got lazy and procrastinated as he thought he didn't have much to do.
- workLoad += .1;
- return false;
- }
- if (feelings <= .2) {
- //Keith is in too bad of a mood to work.
- //But, the mood goes up slowly.
- feelings += .1;
- return false;
- }
- if (health <= .5) {
- //Keith is not feeling well. He takes a trip around go.
- health += .2;
- return false;
- }
- if (fickleness >= .5) {
- //Keith feels fickle. He goes swimming with Old Greg.
- fickleness -= .1;
- return false;
- }
- //Keith does work!
- workLoad -= .02;
- feelings -= .02;
- health -= .02;
- fickleness += .02;
- return true;
- }
- }
- class AIWar extends ArcenGames {
- int painThreshold = 75;
- int numBugs = 7;
- int expansionProgress = 25;
- public int getExpansionProgress() {
- return expansionProgress;
- }
- public void setExpansionProgress(int expansionProgress) {
- this.expansionProgress = expansionProgress;
- }
- public int getNumBugs() {
- return numBugs;
- }
- public void setNumBugs(int numBugs) {
- this.numBugs = numBugs;
- }
- public int getPainThreshold() {
- return painThreshold;
- }
- public void setPainThreshold(int painThreshold) {
- this.painThreshold = painThreshold;
- }
- }
- //Arcen's games.
- enum Game {
- AI_WAR(false),
- A_VALLEY_WITHOUT_WIND(false),
- TIDALIS(false);
- private boolean GAME_KILLED;
- Game(boolean g) {
- this.GAME_KILLED = g;
- }
- boolean getGameKilled() {
- return GAME_KILLED;
- }
- void setGameKilled(boolean state) {
- this.GAME_KILLED = state;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment