UPDATE method removeTile in Rack, attributes in GameBoard
parent
0124b6b3b0
commit
61280da595
|
@ -2,8 +2,8 @@ package latice.model;
|
|||
|
||||
public class GameBoard {
|
||||
private Integer DIMENSION = 9;
|
||||
private final String SUN = " SU ";
|
||||
private final String MOON = " MO ";
|
||||
public static final String SUN = " SU ";
|
||||
public static final String MOON = " MO ";
|
||||
private String[][] gridBoard;
|
||||
|
||||
public GameBoard() {
|
||||
|
|
|
@ -30,6 +30,15 @@ public class Player {
|
|||
|
||||
public void Play(Scanner play, GameBoard board) {
|
||||
System.out.println("c'est à votre tour de jouer " + this.name +"!");
|
||||
if (this.getScore() == 0) {
|
||||
|
||||
System.out.println("Vous avez " + this.getScore() + " point");
|
||||
|
||||
}else {
|
||||
System.out.println("Vous avez " + this.getScore() + " points");
|
||||
|
||||
}
|
||||
|
||||
System.out.print("Quel tuile voulez-vous jouez ? ");
|
||||
this.rack.displayRack();
|
||||
String tileToPlay = play.next();
|
||||
|
@ -42,7 +51,7 @@ public class Player {
|
|||
|
||||
board.displayGameBoard();
|
||||
|
||||
this.rack.updateRack(deck);
|
||||
this.rack.updateRack();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,19 +12,22 @@ import javafx.scene.text.Text;
|
|||
public class Rack {
|
||||
private ArrayList<Tile> listRackTile = new ArrayList<Tile>();
|
||||
private ArrayList<Image> rackTileImage = new ArrayList<Image>();
|
||||
private Deck deck;
|
||||
|
||||
public Rack(Deck deck) {
|
||||
this.deck = deck;
|
||||
|
||||
Tile tile;
|
||||
|
||||
System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int index = (int)(Math.random()*(((deck.getListTile()).size()-1)-0+1)+0); //(int)(Math.random()*(max-min+1)+min);
|
||||
int index = (int)(Math.random()*(((this.deck.getListTile()).size()-1)-0+1)+0); //(int)(Math.random()*(max-min+1)+min);
|
||||
|
||||
tile = (deck.getListTile()).get(index);
|
||||
tile = (this.deck.getListTile()).get(index);
|
||||
this.listRackTile.add(tile);
|
||||
deck.getListTile().remove(index);
|
||||
this.deck.getListTile().remove(index);
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -45,16 +48,16 @@ public class Rack {
|
|||
}
|
||||
|
||||
|
||||
public void updateRack(Deck deck) {
|
||||
public void updateRack() {
|
||||
|
||||
Tile tile;
|
||||
|
||||
for (int i = 0; i < 5-this.listRackTile.size() ; i++) {
|
||||
int index = (int)(Math.random()*( ((deck.getListTile()).size()-1)-0+1)+0); //(int)(Math.random()*(max-min+1)+min);
|
||||
int index = (int)(Math.random()*( ((this.deck.getListTile()).size()-1)-0+1)+0); //(int)(Math.random()*(max-min+1)+min);
|
||||
|
||||
tile = (deck.getListTile()).get(index);
|
||||
tile = (this.deck.getListTile()).get(index);
|
||||
this.listRackTile.add(tile);
|
||||
deck.getListTile().remove(index);
|
||||
this.deck.getListTile().remove(index);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue