Guest User

arcengames!

a guest
Dec 4th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package arcen;
  2.  
  3. import java.util.Random;
  4.  
  5. /**
  6.  * @author Pluto
  7.  */
  8. public class ArcenGames {
  9.    
  10.     public static void main(String[] args) {
  11.         //Ahoy a company!
  12.         ArcenGames ag = new ArcenGames();
  13.     }
  14.    
  15.     //Global random generator, never know what you find when you get out.
  16.     Random r = new Random();
  17.  
  18.     ArcenGames() {
  19.         for (Game g : Game.values()) {
  20.             Keith keith = new Keith(r);
  21.             for (int hour = 9; hour < 17; hour++) {
  22.                 switch (g) {
  23.                     case AI_WAR:
  24.                         if (!g.getGameKilled()) {
  25.                             AIWar a = new AIWar();
  26.                             int weight = r.nextInt(100);
  27.                             if (weight > 80) {
  28.                                 keith.addPain(a);
  29.                             } else if (weight <= 80 && weight > 5) {
  30.                                 keith.fixBugs(a);
  31.                             } else if (weight <= 5 && weight > 0) {
  32.                                 keith.addToExpansion(a);
  33.                             } else  if (weight == 0 ){
  34.                                 //He killed it.
  35.                                 g.setGameKilled(true);
  36.                                 close();
  37.                             } else {
  38.                                 //Keith wins the powerball and runs away.
  39.                                 close();
  40.                             }
  41.                         }
  42.                         break;
  43.                     case A_VALLEY_WITHOUT_WIND:
  44.                         if (!g.getGameKilled()) {
  45.                             keith.idunknowwhatthisgamereallyis(10);
  46.                         }
  47.                         break;
  48.                     case TIDALIS:
  49.                         if (!g.getGameKilled()) {
  50.                             keith.ialsodontknowwhatsinthisgame();
  51.                         }
  52.                         break;
  53.                 }
  54.             }
  55.         }
  56.     }
  57.  
  58.     private void close() {
  59.         Runtime.getRuntime().exit(0);
  60.     }
  61. }
  62.  
  63. //Arcen's games.
  64. class Keith {
  65.  
  66.     //Keith is a person.  Person's have health.  Some people are healthy.  Some people are not.
  67.     double health;
  68.     //Keith has feelings!  Though sometimes I wonder...
  69.     double feelings;
  70.     //Keith is fickle.  Very very fickle.
  71.     double fickleness;
  72.     //Keith has a work load. This is part of having a job.
  73.     double workLoad;
  74.     Random r;
  75.  
  76.     Keith(Random r) {
  77.         health = r.nextDouble();
  78.         feelings = r.nextDouble();
  79.         fickleness = r.nextDouble();
  80.         workLoad = r.nextDouble();
  81.         this.r = r;
  82.     }
  83.  
  84.     double getHealth() {
  85.         return health;
  86.     }
  87.  
  88.     double getFeelings() {
  89.         return feelings;
  90.     }
  91.  
  92.     double getFickleness() {
  93.         return fickleness;
  94.     }
  95.  
  96.     double getWorkLoad() {
  97.         return workLoad;
  98.     }
  99.  
  100.     /**
  101.      * This should be self explanatory.
  102.      */
  103.     void idunknowwhatthisgamereallyis(int i) {
  104.         //umm, what?
  105.         throw new UnsupportedOperationException("Not yet implemented");
  106.     }
  107.  
  108.     /**
  109.      * This should also be self explanatory.
  110.      */
  111.     void ialsodontknowwhatsinthisgame() {
  112.         //yeah, above.
  113.         throw new UnsupportedOperationException("Not yet implemented");
  114.     }
  115.  
  116.     /**
  117.      * Keith adds something to make AI War more painful.
  118.      *
  119.      * @param a
  120.      */
  121.     void addPain(AIWar a) {
  122.         if (this.works()) {
  123.             //No limit in the pain threshold.
  124.             a.setPainThreshold(a.getPainThreshold() + 1);
  125.         }
  126.     }
  127.  
  128.     /**
  129.      * Keith fixes bugs inherent in AI war.
  130.      *
  131.      * @param a
  132.      */
  133.     void fixBugs(AIWar a) {
  134.         if (this.works()) {
  135.             //Constantly fix bugs.
  136.             if (a.getNumBugs() > 0) {
  137.                 a.setNumBugs(a.getNumBugs() - 1);
  138.             } else {
  139.                 //...  but if they all get fixed, inevitably more have creeped in.
  140.                 a.setNumBugs(7);
  141.             }
  142.         }
  143.     }
  144.  
  145.     /**
  146.      * Keith adds to the expansion progress of AI war.
  147.      *
  148.      * @param a
  149.      */
  150.     void addToExpansion(AIWar a) {
  151.         if (this.works()) {
  152.             //Still working towards the next expansion!
  153.             if (a.getExpansionProgress() < 100) {
  154.                 a.setExpansionProgress(a.getExpansionProgress() + 1);
  155.             } else {
  156.                 //And if it's finished, there's always a new one to start.
  157.                 a.setExpansionProgress(0);
  158.             }
  159.         }
  160.     }
  161.  
  162.     /**
  163.      * Simple determination of whether Keith gets work done.
  164.      *
  165.      * @return Whether Keith works.
  166.      */
  167.     private boolean works() {
  168.         if (workLoad <= .4) {
  169.             //Keith got lazy and procrastinated as he thought he didn't have much to do.
  170.             workLoad += .1;
  171.             return false;
  172.         }
  173.         if (feelings <= .2) {
  174.             //Keith is in too bad of a mood to work.
  175.             //But, the mood goes up slowly.
  176.             feelings += .1;
  177.             return false;
  178.         }
  179.         if (health <= .5) {
  180.             //Keith is not feeling well.  He takes a trip around go.
  181.             health += .2;
  182.             return false;
  183.         }
  184.         if (fickleness >= .5) {
  185.             //Keith feels fickle.  He goes swimming with Old Greg.
  186.             fickleness -= .1;
  187.             return false;
  188.         }
  189.  
  190.         //Keith does work!
  191.         workLoad -= .02;
  192.         feelings -= .02;
  193.         health -= .02;
  194.         fickleness += .02;
  195.         return true;
  196.     }
  197. }
  198.  
  199. class AIWar extends ArcenGames {
  200.  
  201.     int painThreshold = 75;
  202.     int numBugs = 7;
  203.     int expansionProgress = 25;
  204.  
  205.     public int getExpansionProgress() {
  206.         return expansionProgress;
  207.     }
  208.  
  209.     public void setExpansionProgress(int expansionProgress) {
  210.         this.expansionProgress = expansionProgress;
  211.     }
  212.  
  213.     public int getNumBugs() {
  214.         return numBugs;
  215.     }
  216.  
  217.     public void setNumBugs(int numBugs) {
  218.         this.numBugs = numBugs;
  219.     }
  220.  
  221.     public int getPainThreshold() {
  222.         return painThreshold;
  223.     }
  224.  
  225.     public void setPainThreshold(int painThreshold) {
  226.         this.painThreshold = painThreshold;
  227.     }
  228. }
  229.  
  230. //Arcen's games.
  231. enum Game {
  232.  
  233.     AI_WAR(false),
  234.     A_VALLEY_WITHOUT_WIND(false),
  235.     TIDALIS(false);
  236.     private boolean GAME_KILLED;
  237.  
  238.     Game(boolean g) {
  239.         this.GAME_KILLED = g;
  240.     }
  241.  
  242.     boolean getGameKilled() {
  243.         return GAME_KILLED;
  244.     }
  245.  
  246.     void setGameKilled(boolean state) {
  247.         this.GAME_KILLED = state;
  248.     }
  249. }
Advertisement
Add Comment
Please, Sign In to add comment