Bonjour,
j'ai rédiger cette méthode hier en td en la mettant avec un pseudo main pour voir si elle fonctionne.
A vu d'oeil, quelqu'un sait il ce qui cloche?
eclipse me dit que cette méthode doit retourner un booléen.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public class testb{ boolean [][] lesMines(int nbmine){ boolean[][]plateau=new boolean[8][8]; for(int i=0; i<nbmine; i++){ int x, y; x=(int)(Math.random()*8); y=(int)(Math.random()*8); if(plateau[x][y]== true){ x=(int)(Math.random()*8); y=(int)(Math.random()*8); }else{ plateau[x][y]=true; } if(plateau[x][y]=true){ Terminal.ecrireChar('m'); }else{ Terminal.ecrireChar('o'); } return plateau; } } public static void main(String [] args){ boolean[][]plateau = new boolean[8][8]; int nbmine=10; } }
Merci
Partager