-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarte.java
More file actions
67 lines (49 loc) · 1.71 KB
/
Carte.java
File metadata and controls
67 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.*;
public class Carte{
public static void main(String[] args){
char board[][] = new char [20][20];
char personnage = 'X';
char herbe = ' ';
char rocher = '1';
char rod = '2';
for(int x = 0; x < 20; x++) {
for(int y = 0; y < 20; y++) {
if(x==0 && y==0){
board[x][y] = 'X';
}
board[x][y] = herbe;
}
}
for (int a=0; a<5; a++){
int randomX = (int)(Math.random()*20);
int randomY = (int)(Math.random()*20);
board[randomX][randomY] = rocher;
}
for (int a=0; a<8; a++){
int randomX = (int)(Math.random()*20);
int randomY = (int)(Math.random()*20);
board[randomX][randomY] = rod;
}
for(int x = 0; x < 20; x++) {
for(int y = 0; y < 20; y++) {
// for(int a = 0; a < 20; a++) {
// int chances = (int)(Math.random()*20)+1;
// if (chances == 1) {
// board[x][y] = 'A';
// }
// }
// for(int b = 0; b < 10; b++) {
// int chances = (int)(Math.random()*20)+1;
// if (chances == 1) {
// board[x][y] = 'B';
// }
// if(board[x][y] == 0 ) {
// board[x][y] = 'C';
// }
// }
System.out.print(board[x][y]);
}
System.out.println();
}
}
}