Advertisement
Guest User

Game.java

a guest
Aug 9th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.02 KB | None | 0 0
  1. package org.goverment;
  2.  
  3. import static org.goverment.Tg.cout;
  4.  
  5. import java.io.File;
  6. import java.io.FileInputStream;
  7. import java.io.IOException;
  8. import java.io.PrintWriter;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11. import java.util.Properties;
  12. import java.util.Random;
  13.  
  14. public class Game {
  15.  
  16.     public static String name;
  17.  
  18.     public static final Properties prop = new Properties();
  19.  
  20.     public static final void setup(List<String> list, String name,
  21.             boolean soviet) throws IOException {
  22.         File fl = new File(
  23.                 "C:\\Documents and Settings\\Administrator"
  24.                 + "\\Application Data\\thegoverment.properties");
  25.         if (!fl.exists()) {
  26.             fl.createNewFile();
  27.             PrintWriter writer = new PrintWriter(fl);
  28.             writer.println("###################");
  29.             writer.println("#  The Goverment  #");
  30.             writer.println("#   Propertiiis   #");
  31.             writer.println("# Only for Cheats #");
  32.             writer.println("###################");
  33.             writer.println("");
  34.             String s = "";
  35.             for (String d : list) {
  36.                 s = s + d.replace(" ", ";") + "-";
  37.             }
  38.             s = s.substring(0, s.length() - 1);
  39.             writer.println("other-countries=" + s);
  40.             writer.println("country-name=" + name);
  41.             writer.println("is-soviet-country=" + soviet);
  42.             writer.close();
  43.         }
  44.         cout(fl.getAbsolutePath() + "/");
  45.         prop.load(new FileInputStream(fl));
  46.     }
  47.  
  48.     public static final List<String> cc() {
  49.         List<String> countryNames = new ArrayList<String>();
  50.         for (int i = 0; i < 48; i++) {
  51.             boolean done = false;
  52.             while (!done) {
  53.                 String name = choose("The Republic of ", "United States of ",
  54.                         "")
  55.                         + choose("Christian Federation", "Ironia", "Onyxia",
  56.                                 "Nervia", "China", "Ukraine", "America",
  57.                                 "Japan", "Korea", "Laxembourg");
  58.                 if (!countryNames.contains(name)) {
  59.                     countryNames.add(name);
  60.                     done = true;
  61.                 }
  62.             }
  63.         }
  64.         return countryNames;
  65.     }
  66.  
  67.     private static String choose(String... s) {
  68.         return s[new Random().nextInt(s.length)];
  69.     }
  70.  
  71.     public static void start() {
  72.         cout("Country Name: " + name + "/");
  73.     }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement