Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package worldcupgroups;
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.Scanner;
- /**
- *
- * @author dudu
- */
- public class WORLDCUPGROUPS {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner Input = new Scanner(System.in);
- String TeamName;
- String Choice = "";
- String strmark = "";
- int teamNum;
- String[] SEEDs = new String[8];
- String[] Africa = new String[8];
- String[] Asia = new String[8];
- String[] Europe = new String[9];
- String[] GROUPA = new String[4];
- String[] GROUPB = new String[4];
- String[] GROUPC = new String[4];
- String[] GROUPD = new String[4];
- String[] GROUPE = new String[4];
- String[] GROUPF = new String[4];
- String[] GROUPG = new String[4];
- String[] GROUPH = new String[4];
- initialize(SEEDs, Africa,Asia, Europe);
- loadSEED(SEEDs);
- loadAFRICA(Africa,Europe);
- loadASIA(Asia);
- loadEurope(Europe);
- int b;
- b = (int) Math.floor(Math.random() *7) ;
- if (Africa[7].equals("e") ){
- Africa[7]=Europe[b];
- for (int i = b; i <8; i++) {
- Europe[i]=Europe[i+1];
- }
- }
- System.out.println("SEEDS ");
- for (int i = 0; i < SEEDs.length; i++) {
- System.out.println((i + 1) + " " + SEEDs[i]);
- }
- System.out.println("");
- System.out.println("AFRICA ");
- for (int i = 0; i < Africa.length; i++) {
- System.out.println((i + 1) + " " + Africa[i]);
- }
- System.out.println("");
- System.out.println("ASIA ");
- for (int i = 0; i < Asia.length; i++) {
- System.out.println((i + 1) + " " + Asia[i]);
- }
- System.out.println("");
- System.out.println("EUROPE");
- for (int i = 0; i <8; i++) {
- System.out.println((i + 1) + " " + Europe[i]);
- }
- System.out.println("");
- Groups(SEEDs, Africa, Asia, Europe, GROUPA, GROUPB, GROUPC, GROUPD, GROUPE, GROUPF, GROUPG, GROUPH);
- fixtures( GROUPA, GROUPB, GROUPC, GROUPD, GROUPE, GROUPF, GROUPG, GROUPH);
- }
- private static void initialize(String SEeds[],String AFRica[],String ASia[],String EUrope[]) { // initialize function
- for (int x = 0; x < SEeds.length; x++) {
- SEeds[x] = "e";
- }
- for (int x = 0; x < AFRica.length; x++) {
- AFRica[x] = "e";
- }
- for (int x = 0; x < ASia.length; x++) {
- ASia[x] = "e";
- }
- for (int x = 0; x < EUrope.length; x++) {
- EUrope[x] = "e";
- }
- }
- private static void loadSEED(String SEEDS[]) { // load function
- System.out.println(" TEAMS THAT QUALIFIED FOR THE WORLD CUP ");
- System.out.println(" -------------------------------------- ");
- int lineCount = 0;
- try {
- Scanner rf = new Scanner(new BufferedReader(new FileReader("SEEDS.txt")));
- while (rf.hasNext() && lineCount < SEEDS.length) {
- SEEDS[lineCount] = rf.nextLine();
- lineCount++;
- }
- rf.close();
- } catch (IOException e) {
- System.out.println("Error IOException is: " + e);
- }
- }
- private static void loadAFRICA(String AFRICA[], String Europe[]) {
- int linecount = 0;
- try {
- Scanner rf = new Scanner(new BufferedReader(new FileReader("AFRICA.txt")));
- while (rf.hasNext() && linecount < AFRICA.length) {
- AFRICA[linecount] = rf.nextLine();
- linecount++;
- }
- rf.close();
- } catch (IOException e) {
- System.out.println("Error IOException is: " + e);
- }
- }
- private static void loadASIA(String ASIA[]) {
- int linecounts = 0;
- try {
- Scanner rf = new Scanner(new BufferedReader(new FileReader("ASIA.txt")));
- while (rf.hasNext() && linecounts < ASIA.length) {
- ASIA[linecounts] = rf.nextLine();
- linecounts++;
- }
- rf.close();
- } catch (IOException e) {
- System.out.println("Error IOException is: " + e);
- }
- }
- private static void loadEurope(String EUROPE[]) {
- int LineCount = 0;
- try {
- Scanner rf = new Scanner(new BufferedReader(new FileReader("EUROPE.txt")));
- while (rf.hasNext() && LineCount < EUROPE.length) {
- EUROPE[LineCount] = rf.nextLine();
- LineCount++;
- }
- rf.close();
- } catch (IOException e) {
- System.out.println("Error IOException is: " + e);
- }
- System.out.println(" ");
- }
- private static void Groups(String seeds[], String africa[], String asia[], String europe[], String gROUPA[], String gROUPB[], String gROUPC[], String gROUPD[], String gROUPE[], String gROUPF[], String gROUPG[], String gROUPH[]) {
- System.out.println(" GROUP STAGES ");
- System.out.println(" ------------ ");
- int a, b, c, d;
- b = (int) Math.floor(Math.random() * 7);
- c = (int) Math.floor(Math.random() * 7);
- d = (int) Math.floor(Math.random() * 7);
- a = (int) Math.floor(Math.random() * 7);
- gROUPA[0] = seeds[b];
- gROUPA[1] = africa[c];
- gROUPA[2] = asia[d];
- gROUPA[3] = europe[a];
- for (int i = 0; i < 7; i++) {
- seeds[b] = seeds[b + 1];
- seeds[b] = seeds[7];
- }
- for (int i = 0; i < 7; i++) {
- africa[c] = africa[c + 1];
- africa[c] = africa[7];
- }
- for (int i = 0; i < 7; i++) {
- asia[d] = asia[d + 1];
- asia[d] = asia[7];
- }
- for (int i = 0; i < 7; i++) {
- europe[a] = europe[a + 1];
- europe[a] = europe[7];
- }
- int e, f, g, h;
- e = (int) Math.floor(Math.random() * 6);
- f = (int) Math.floor(Math.random() * 6);
- g = (int) Math.floor(Math.random() * 6);
- h = (int) Math.floor(Math.random() * 6);
- gROUPB[0] = seeds[e];
- gROUPB[1] = africa[f];
- gROUPB[2] = asia[g];
- gROUPB[3] = europe[h];
- for (int i = 0; i < 6; i++) {
- seeds[e] = seeds[e + 1];
- seeds[e] = seeds[6];
- }
- for (int i = 0; i < 6; i++) {
- africa[f] = africa[f + 1];
- africa[f] = africa[6];
- }
- for (int i = 0; i < 6; i++) {
- asia[g] = asia[g + 1];
- asia[g] = asia[6];
- }
- for (int i = 0; i < 6; i++) {
- europe[h] = europe[h + 1];
- europe[h] = europe[6];
- }
- int Z, j, k, l;
- Z = (int) Math.floor(Math.random() * 5);
- j = (int) Math.floor(Math.random() * 5);
- k = (int) Math.floor(Math.random() * 5);
- l = (int) Math.floor(Math.random() * 5);
- gROUPC[0] = seeds[Z];
- gROUPC[1] = africa[j];
- gROUPC[2] = asia[k];
- gROUPC[3] = europe[l];
- for (int i = 0; i < 5; i++) {
- seeds[Z] = seeds[Z + 1];
- seeds[Z] = seeds[5];
- }
- for (int i = 0; i < 5; i++) {
- africa[j] = africa[j + 1];
- africa[j] = africa[5];
- }
- for (int i = 0; i < 5; i++) {
- asia[k] = asia[k + 1];
- asia[k] = asia[5];
- }
- for (int i = 0; i < 5; i++) {
- europe[l] = europe[l + 1];
- europe[l] = europe[5];
- }
- int m, n, o, p;
- m = (int) Math.floor(Math.random() * 4);
- n = (int) Math.floor(Math.random() * 4);
- o = (int) Math.floor(Math.random() * 4);
- p = (int) Math.floor(Math.random() * 4);
- gROUPD[0] = seeds[m];
- gROUPD[1] = africa[n];
- gROUPD[2] = asia[o];
- gROUPD[3] = europe[p];
- for (int i = 0; i < 4; i++) {
- seeds[m] = seeds[m + 1];
- seeds[m] = seeds[4];
- }
- for (int i = 0; i < 4; i++) {
- africa[n] = africa[n + 1];
- africa[n] = africa[4];
- }
- for (int i = 0; i < 4; i++) {
- asia[o] = asia[o + 1];
- asia[o] = asia[4];
- }
- for (int i = 0; i < 4; i++) {
- europe[p] = europe[p + 1];
- europe[p] = europe[4];
- }
- int q, r, s, t;
- q = (int) Math.floor(Math.random() * 3);
- r = (int) Math.floor(Math.random() * 3);
- s = (int) Math.floor(Math.random() * 3);
- t = (int) Math.floor(Math.random() * 3);
- gROUPE[0] = seeds[q];
- gROUPE[1] = africa[r];
- gROUPE[2] = asia[s];
- gROUPE[3] = europe[t];
- for (int i = 0; i < 3; i++) {
- seeds[q] = seeds[q + 1];
- seeds[q] = seeds[3];
- }
- for (int i = 0; i < 3; i++) {
- africa[r] = africa[r + 1];
- africa[r] = africa[3];
- }
- for (int i = 0; i < 3; i++) {
- asia[s] = asia[s + 1];
- asia[s] = asia[3];
- }
- for (int i = 0; i < 3; i++) {
- europe[t] = europe[t + 1];
- europe[t] = europe[3];
- }
- int u, v, w, x;
- u = (int) Math.floor(Math.random() * 2);
- v = (int) Math.floor(Math.random() * 2);
- w = (int) Math.floor(Math.random() * 2);
- x = (int) Math.floor(Math.random() * 2);
- gROUPF[0] = seeds[u];
- gROUPF[1] = africa[v];
- gROUPF[2] = asia[w];
- gROUPF[3] = europe[x];
- for (int i = 0; i < 2; i++) {
- seeds[u] = seeds[u + 1];
- seeds[u] = seeds[2];
- }
- for (int i = 0; i < 2; i++) {
- africa[v] = africa[v + 1];
- africa[v] = africa[2];
- }
- for (int i = 0; i < 2; i++) {
- asia[w] = asia[w + 1];
- asia[w] = asia[2];
- }
- for (int i = 0; i < 2; i++) {
- europe[x] = europe[x + 1];
- europe[x] = europe[2];
- }
- int y, z, A, B;
- A = (int) Math.floor(Math.random() * 1);
- y = (int) Math.floor(Math.random() * 1);
- z = (int) Math.floor(Math.random() * 1);
- B = (int) Math.floor(Math.random() * 1);
- gROUPG[0] = seeds[A];
- gROUPG[1] = africa[y];
- gROUPG[2] = asia[z];
- gROUPG[3] = europe[B];
- for (int i = 0; i < 1; i++) {
- seeds[A] = seeds[A + 1];
- seeds[A] = seeds[1];
- }
- for (int i = 0; i < 1; i++) {
- africa[y] = africa[y + 1];
- africa[y] = africa[1];
- }
- for (int i = 0; i < 1; i++) {
- asia[z] = asia[z + 1];
- asia[z] = asia[1];
- }
- for (int i = 0; i < 1; i++) {
- europe[B] = europe[B + 1];
- europe[B] = europe[1];
- }
- int C, D, E, F;
- C = (int) Math.floor(Math.random() * 0);
- D = (int) Math.floor(Math.random() * 0);
- E = (int) Math.floor(Math.random() * 0);
- F = (int) Math.floor(Math.random() * 0);
- gROUPH[0] = seeds[C];
- gROUPH[1] = africa[D];
- gROUPH[2] = asia[E];
- gROUPH[3] = europe[F];
- for (int i = 0; i < 1; i++) {
- seeds[C] = seeds[C + 1];
- seeds[C] = seeds[0];
- }
- for (int i = 0; i < 1; i++) {
- africa[D] = africa[D + 1];
- africa[D] = africa[0];
- }
- for (int i = 0; i < 1; i++) {
- asia[E] = asia[E + 1];
- asia[E] = asia[0];
- }
- for (int i = 0; i < 1; i++) {
- europe[F] = europe[F + 1];
- europe[F] = europe[0];
- }
- System.out.println(" ");
- System.out.println(" GROUP A ");
- System.out.println(" -------");
- for (int G = 0; G < 4; G++) {
- System.out.println(gROUPA[G]);
- }
- System.out.println(" ");
- System.out.println(" GROUP B ");
- System.out.println(" -------");
- for (int H = 0; H < 4; H++) {
- System.out.println(gROUPB[H]);
- }
- System.out.println(" ");
- System.out.println(" GROUP C ");
- System.out.println(" -------");
- for (int I = 0; I < 4; I++) {
- System.out.println(gROUPC[I]);
- }
- System.out.println(" ");
- System.out.println(" GROUP D ");
- System.out.println(" -------");
- for (int J = 0; J < 4; J++) {
- System.out.println(gROUPD[J]);
- }
- System.out.println(" ");
- System.out.println(" GROUP E ");
- System.out.println(" -------");
- for (int K = 0; K < 4; K++) {
- System.out.println(gROUPE[K]);
- }
- System.out.println(" ");
- System.out.println(" GROUP F ");
- System.out.println(" -------");
- for (int L = 0; L < 4; L++) {
- System.out.println(gROUPF[L]);
- }
- System.out.println(" ");
- System.out.println(" GROUP G ");
- System.out.println(" -------");
- for (int M = 0; M < 4; M++) {
- System.out.println(gROUPG[M]);
- }
- System.out.println(" ");
- System.out.println(" GROUP H ");
- System.out.println(" -------");
- for (int N = 0; N < 4; N++) {
- System.out.println(gROUPH[N]);
- }
- System.out.println(" ");
- }
- private static void fixtures(String gROUPA[], String gROUPB[], String gROUPC[], String gROUPD[], String gROUPE[], String gROUPF[], String gROUPG[], String gROUPH[]) {
- System.out.print(" "); System.out.println(" FIXTURES ");
- System.out.print(" "); System.out.println(" -------- ");
- int i=0,a=i+2;
- System.out.print(" "); System.out.println(" GROUP A ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPA[i] + " vs " + gROUPA[2]);
- System.out.print(" "); System.out.println( gROUPA[a] + " vs " + gROUPA[a+1]);
- System.out.print(" "); System.out.println( gROUPA[i] + " vs " + gROUPA[a]);
- System.out.print(" "); System.out.println( gROUPA[i+1] + " vs " + gROUPA[a]);
- System.out.print(" "); System.out.println( gROUPA[i+1]+ " vs " + gROUPA[a+1]);
- System.out.print(" "); System.out.println( gROUPA[a+1] +" vs " + gROUPA[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP B ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPB[i] + " vs " + gROUPB[i+1]);
- System.out.print(" "); System.out.println( gROUPB[a] + " vs " + gROUPB[a+1]);
- System.out.print(" "); System.out.println( gROUPB[i] + " vs " + gROUPB[a]);
- System.out.print(" "); System.out.println( gROUPB[i+1] + " vs " + gROUPB[a]);
- System.out.print(" "); System.out.println( gROUPB[i+1]+ " vs " + gROUPB[a+1]);
- System.out.print(" "); System.out.println( gROUPB[a+1] +" vs " + gROUPB[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP C ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPC[i] + " vs " + gROUPB[i+1]);
- System.out.print(" "); System.out.println( gROUPC[a] + " vs " + gROUPC[a+1]);
- System.out.print(" "); System.out.println( gROUPC[i] + " vs " + gROUPC[a]);
- System.out.print(" "); System.out.println( gROUPC[i+1] + " vs " + gROUPC[a]);
- System.out.print(" "); System.out.println( gROUPC[i+1]+ " vs " + gROUPC[a+1]);
- System.out.print(" "); System.out.println( gROUPC[a+1] +" vs " + gROUPC[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP D ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPD[i] + " vs " + gROUPD[i+1]);
- System.out.print(" "); System.out.println( gROUPD[a] + " vs " + gROUPD[a+1]);
- System.out.print(" "); System.out.println( gROUPD[i] + " vs " + gROUPD[a]);
- System.out.print(" "); System.out.println( gROUPD[i+1] + " vs " + gROUPD[a]);
- System.out.print(" "); System.out.println( gROUPD[i+1]+ " vs " + gROUPD[a+1]);
- System.out.print(" "); System.out.println( gROUPD[a+1] +" vs " + gROUPD[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP E ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPE[i] + " vs " + gROUPE[i+1]);
- System.out.print(" "); System.out.println( gROUPE[a] + " vs " + gROUPE[a+1]);
- System.out.print(" "); System.out.println( gROUPE[i] + " vs " + gROUPE[a]);
- System.out.print(" "); System.out.println( gROUPE[i+1] + " vs " + gROUPE[a]);
- System.out.print(" "); System.out.println( gROUPE[i+1]+ " vs " + gROUPE[a+1]);
- System.out.print(" "); System.out.println( gROUPE[a+1] +" vs " + gROUPE[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP F ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPF[i] + " vs " + gROUPF[i+1]);
- System.out.print(" "); System.out.println( gROUPF[a] + " vs " + gROUPF[a+1]);
- System.out.print(" "); System.out.println( gROUPF[i] + " vs " + gROUPF[a]);
- System.out.print(" "); System.out.println( gROUPF[i+1] + " vs " + gROUPF[a]);
- System.out.print(" "); System.out.println( gROUPF[i+1]+ " vs " + gROUPF[a+1]);
- System.out.print(" "); System.out.println( gROUPF[a+1] +" vs " + gROUPF[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP G ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPG[i] + " vs " + gROUPG[i+1]);
- System.out.print(" "); System.out.println( gROUPG[a] + " vs " + gROUPG[a+1]);
- System.out.print(" "); System.out.println( gROUPG[i] + " vs " + gROUPG[a]);
- System.out.print(" "); System.out.println( gROUPG[i+1] + " vs " + gROUPG[a]);
- System.out.print(" "); System.out.println( gROUPG[i+1]+ " vs " + gROUPG[a+1]);
- System.out.print(" "); System.out.println( gROUPG[a+1] +" vs " + gROUPG[i]);
- System.out.println(" ");
- System.out.print(" "); System.out.println(" GROUP H ");
- System.out.print(" ");System.out.println(" -------- ");
- System.out.print(" "); System.out.println( gROUPH[i] + " vs " + gROUPH[i+1]);
- System.out.print(" "); System.out.println( gROUPH[a] + " vs " + gROUPH[a+1]);
- System.out.print(" "); System.out.println( gROUPH[i] + " vs " + gROUPH[a]);
- System.out.print(" "); System.out.println( gROUPH[i+1] + " vs " + gROUPH[a]);
- System.out.print(" "); System.out.println( gROUPH[i+1]+ " vs " + gROUPH[a+1]);
- System.out.print(" "); System.out.println( gROUPH[a+1] +" vs " + gROUPH[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement