Skip to content
Snippets Groups Projects
Commit be847d4a authored by CARION Baptiste's avatar CARION Baptiste
Browse files

Amelioration de la generation du monde, ajout des montagnes et correction de...

Amelioration de la generation du monde, ajout des montagnes et correction de la generation aleatoire
parent 19f37e07
No related branches found
No related tags found
No related merge requests found
......@@ -3,22 +3,23 @@ package main;
public class Affichage {
public static void affichage(Plateau plateau){
String montagne = "◼";
String foret = "◻";
String eau = "▨";
String inconnu = "~";
final char plaine = '.';
final char montagne = '◼';
final char inconnu = '~';
for(int i=0; i< plateau.getPlateau().length*5; i++) {
for(int j=0; j< plateau.getPlateau()[0].length*5; j++) {
if(plateau.getCase(i, j).getType()==Type.FORT) {
System.out.print("W");
System.out.print("F");
}else if(plateau.getCase(i, j).getUnite() != null) {
System.out.print(plateau.getCase(i, j).getUnite().getSymbol());
}else {
if (plateau.getCase(i, j).getType()==Type.GRASS) {
System.out.print(plaine);
}
else if (plateau.getCase(i, j).getType()==Type.MOUNTAIN) {
System.out.print(montagne);
}
}
}
System.out.println();
}
......
package main;
import java.util.Random;
public class Region {
public Case[][] region = new Case[5][5];
private Joueur proprietaire = null;
public Region() {
Random random = new Random();
for (int i = 0; i < region.length; i++) {
for (int j = 0; j < region[0].length; j++) {
if (random.nextInt(8) == 1) {
region[i][j] = new Case(Type.MOUNTAIN);
}
else {
region[i][j] = new Case(Type.GRASS);
}
}
int rd1 = (int)Math.random()*6;
int rd2 = (int)Math.random()*6;
}
int rd1 = (int)random.nextInt(5);
int rd2 = (int)random.nextInt(5);
region[rd1][rd2].setEvent(Event.FORT);
region[rd1][rd2].setType(Type.FORT);
}
......
package main;
public enum Type {
UNITE,GRASS,FORT;
UNITE,GRASS, MOUNTAIN, VILLAGE, FORT;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment