diff --git a/src/main/java/controller/MainWindowController.java b/src/main/java/controller/MainWindowController.java index ccf137d..0d59029 100644 --- a/src/main/java/controller/MainWindowController.java +++ b/src/main/java/controller/MainWindowController.java @@ -112,7 +112,7 @@ public class MainWindowController implements IObserver { } gc.fillText("" + value, x + (this.squareSize / 2), y + (this.squareSize / 2)); - + } } } diff --git a/src/main/java/model/Board.java b/src/main/java/model/Board.java index 7ed60a7..8d1586d 100644 --- a/src/main/java/model/Board.java +++ b/src/main/java/model/Board.java @@ -88,10 +88,17 @@ public class Board implements IModel{ if(choices.size()>0){ int index=0; if(choices.size()>1){ - index=rand.nextInt(choices.size()-1) + 0; + index=rand.nextInt(choices.size()-1 +1) + 0; } Integer[] xy=(Integer[])choices.toArray()[index]; - this.board[xy[0]][xy[1]]=2; + int twoOrFour=rand.nextInt(3-0 +1) + 0; + switch (twoOrFour){ + case 0: + this.board[xy[0]][xy[1]]=4; + break; + default: + this.board[xy[0]][xy[1]]=2; + } } }