package model; import java.util.ArrayList; import java.util.Collection; import java.util.Random; /** * Created by loic on 21/09/16. */ public class Board implements IModel{ private int[][] board; private Random rand = new Random(); private LineAlgorithm lineAlgorithm; public Board(int sizeX, int sizeY){ board=new int[sizeY][sizeX]; this.cleanBoard(); } public void goUp() { for(int i=0;i choices=new ArrayList(); for(int i=0;i0){ int index=0; if(choices.size()>1){ index=rand.nextInt(choices.size()-1 +1) + 0; } Integer[] xy=(Integer[])choices.toArray()[index]; 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; } } } private boolean boardsIsEquals(int[][] board1, int[][] board2){ if(board1.length!=board1.length){ return false; } else { for (int i=0;i