WIP add Deck and Rack classes

master
Mathis 2022-04-19 23:24:10 +02:00
parent dba464f4ef
commit 431e9759e9
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package latice.model;
import java.util.ArrayList;
public class Deck {
private ArrayList<Tile> deckTile = new ArrayList<Tile>();
public Deck(ArrayList<Tile> deckTile) {
this.deckTile = deckTile;
}
public void getListTile() {
for (Tile tile : deckTile) {
System.out.println("tuile : couleur = " + tile.getColor() + " forme = " + tile.getShape());
}
}
}

View File

@ -0,0 +1,21 @@
package latice.model;
import java.util.ArrayList;
public class Rack {
private ArrayList<Tile> listRackTile = new ArrayList<Tile>();
public Rack(ArrayList<Tile> deck) {
for (int i = 0; i < 5; i++) {
int index = (int)(Math.random()*(deck.size()-0+1)+0);
listRackTile.add(deck.get(index));
System.out.println("l'indice de la tuile ajouté au rack est : " + index + " qui est la tuile " + deck.get(index));
}
}
}
//(int)(Math.random()*(max-min+1)+min);