Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

3D Arrays on Hangman game - java

$
0
0
  public static String getWords(String cat, String diff)
  {
    Random generator = new Random();
    String name = "";
    String topic[][][] = new String[3][3][3];
    while(cat.equalsIgnoreCase("places")){
      if(diff == "easy"){
        topic[0][0][0] = "Paris";
        topic[0][0][1] = "London";
        topic[0][0][2] = "Sydney";}
      if(diff == "medium"){
        topic[0][1][0] = "Toronto";
        topic[0][1][1] = "Florida";
        topic[0][1][2] = "Frankfurt";}
      else if(diff == "Extreme"){
        topic[0][2][0] = "Barcelona";
        topic[0][2][1] = "Vancouver";
        topic[0][2][2] = "Zimbabwe";}
    }
    while(cat.equalsIgnoreCase("games")){
      if(diff == "easy"){
        topic[1][0][0] = "Halo";      //             \\
        topic[1][0][1] = "Fifa";     //  Easy-Games   \\              
        topic[1][0][2] = "GTA";}     //                 \\    
      else if(diff == "Medium"){
        topic[1][1][0] = "Skyrim";
        topic[1][1][1] = "HITMAN";
        topic[1][1][2] = "Batman";}
      else if(diff == "Extreme"){
        topic[1][2][0] = "Minecraft";
        topic[1][2][1] = "Zombieville";
        topic[1][2][2] = "BoderLands";}
    }
    if(cat.equalsIgnoreCase("cars")){
      if(diff == "easy"){
        topic[2][0][0] = "Acura";
        topic[2][0][1] = "Audi";
        topic[2][0][2] = "Bmw";}
      else if(diff == "Medium"){
        topic[2][1][0] = "Bentley";
        topic[2][1][1] = "Buggati";
        topic[2][1][2] = "Honda";}
      else if(diff == "Extreme"){
        topic[2][2][0] = "Lamborghini";
        topic[2][2][1] = "Rolls-Royce";
        topic[2][2][2] = "Mercedes";}
    } 
    
    return cat;
  } 
}


This are my 3d arrays for the game Hangman, like this is my first time doing it, the arrays are for the difficulty chosen and the category, is there a way that this can be called in the main method and use it in this type:

 System.out.println("Choose a category -> places / games / cars")


so when the person chooses a category it will than ask for the difficulty, than it will find a word from those two things given

Viewing all articles
Browse latest Browse all 51036

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>