-1
I am trying to make a game of War in java where the game map is a simple vector of 1 to 16 each number being a country, I made a Random to draw the player the country he will start, but how to assign it to the Player without I have to do 16 if’s?
public class Mundo {
int sensalia = 1;
int kemia = 2;
int sema = 3;
int kardia = 4;
int torkuha = 5;
int ohistet = 6;
int baselia = 7;
int dottinia = 8;
int zellzach = 9;
int freusen = 10;
int sinusia = 11;
int kuclasia = 12;
int phlius = 13;
int plasisia = 14;
int dorumia = 15;
int cresonia = 16;
public int nacaoMae(){
Random rand = new Random(16 + 1);
int result = rand.nextInt();
}
}
Why, instead of creating a variable for a country, you don’t create a string array and assign the vector index?
– Felipe Avelar
What is the player limit? What is the limit for each country?
– Maury Developer