71 lines
1.4 KiB
Java
71 lines
1.4 KiB
Java
|
package test;
|
|||
|
|
|||
|
/**
|
|||
|
* @author Olivier DOSSMANN
|
|||
|
*
|
|||
|
*/
|
|||
|
public class VadrouilleGrille {
|
|||
|
|
|||
|
private int[][] grille;
|
|||
|
private int[] positions;
|
|||
|
private int nbreColonnes = 7;
|
|||
|
private int nbreLignes = 6;
|
|||
|
|
|||
|
public static void main(String args[]){
|
|||
|
// Instructions de lancement
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void initialiser()
|
|||
|
{
|
|||
|
int nbr;
|
|||
|
// Cr<43>ation de la grille
|
|||
|
grille = new int[nbreColonnes][nbreLignes];
|
|||
|
|
|||
|
// Cr<43>ation tu tableau de positionnement
|
|||
|
positions = new int[7];
|
|||
|
|
|||
|
// Initialisation du tableau
|
|||
|
for (int i = 0; i < nbreColonnes; i++){
|
|||
|
for(int j = 0; j < nbreLignes; j++){
|
|||
|
nbr = (int)Math.random()*3;
|
|||
|
grille[i][j] = nbr;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Initialisation des positions
|
|||
|
for (int i = 0; i < nbreColonnes; i++){
|
|||
|
positions[i] = 0;
|
|||
|
}
|
|||
|
// // Test
|
|||
|
// grille[4][5] = j1.donneJeton();
|
|||
|
}
|
|||
|
|
|||
|
public void reinitialiser(){
|
|||
|
lancer();
|
|||
|
}
|
|||
|
|
|||
|
public void afficherGrille(){
|
|||
|
for (int i = nbreLignes - 1; i >= 0; i--){
|
|||
|
for(int j = 0; j < nbreColonnes; j++){
|
|||
|
System.out.print(grille[j][i] + "|");
|
|||
|
//System.out.print(j + "/" + i + "|");
|
|||
|
}
|
|||
|
System.out.print("\n");
|
|||
|
}
|
|||
|
System.out.println("--------------");
|
|||
|
System.out.println("1|2|3|4|5|6|7|");
|
|||
|
}
|
|||
|
|
|||
|
public void lancer(){
|
|||
|
System.out.println("Lancement du jeu de plateau");
|
|||
|
|
|||
|
// Initialisation du plateau
|
|||
|
this.initialiser();
|
|||
|
|
|||
|
// Affichage du plateau pour v<>rification
|
|||
|
this.afficherGrille();
|
|||
|
|
|||
|
}
|
|||
|
}
|