package controller;

import model.Board;
import model.CellType;
import model.PlayerModel;
import model.Point;
import boundary.PlayerApplication;

/**
 * 
 * @author Nick Chaput
 *
 */

public class PlayerUpdateBoardCtrl {

	PlayerApplication app;
	PlayerModel model;
	
	public PlayerUpdateBoardCtrl(PlayerApplication app, PlayerModel model) {
		this.app = app;
		this.model = model;
	}
	
	 public void processBoard() {
		  for (int x = Board.width - 1; x >= 0; x--) {
			 /* try {
			       Thread.sleep(15);
					// app.getView().paintImmediately(0, 0, 500, 500);
			    } catch (InterruptedException ie) {
			    }*/
			  boolean hasEmpty = false;
			  for (int y = Board.height - 1; y >= 0; y--) {
				  if (model.level.currentBoard.grid[y][x].type != CellType.INERT 
						  && model.level.currentBoard.grid[y][x].type != CellType.BUCKET
						  && model.level.currentBoard.grid[y][x].tile == null) {
					  model.level.currentBoard.grid[y][x].tile = model.level.currentBoard.takeTileAbove(new Point(x,y));
					  hasEmpty = true;
					    /*try {
						       Thread.sleep(30);
								 app.getView().paintImmediately(50, 50, 500, 500);
						    } catch (InterruptedException ie) {
						    }*/
				  }
				  if (model.level.currentBoard.grid[y][x].type == CellType.BUCKET
						  && model.level.currentBoard.getTileAbove(new Point(x,y)).number == 5
						  && model.level.currentBoard.grid[y][x].tile == null) {
					  model.level.currentBoard.grid[y][x].tile = model.level.currentBoard.takeTileAbove(new Point(x,y));
					  hasEmpty = true;
					    /*try {
						       Thread.sleep(30);
								 app.getView().paintImmediately(50, 50, 500, 500);
						    } catch (InterruptedException ie) {
						    }*/
				  }
			  }
			  if (hasEmpty) {
				  try {
				       Thread.sleep(60);
						 app.getView().paintImmediately(0, 0, 500, 500);
				    } catch (InterruptedException ie) {
				    }
			  }
		  }
	 }
	
}

@@ -1029,34 +1029,32 @@
  true;%0A%09%09%09%09%09    
-/*
 try %7B%0A%09%09%09%09%09%09    
@@ -1061,33 +1061,33 @@
    Thread.sleep(
-3
+1
 0);%0A%09%09%09%09%09%09%09%09 app
@@ -1106,37 +1106,35 @@
 aintImmediately(
-5
 0, 
-5
 0, 500, 500);%0A%09%09
@@ -1180,34 +1180,32 @@
 e) %7B%0A%09%09%09%09%09%09    %7D
-*/
 %0A%09%09%09%09  %7D%0A%09%09%09%09  i
@@ -1546,18 +1546,16 @@
 %09%09%09%09    
-/*
 try %7B%0A%09%09
@@ -1582,9 +1582,9 @@
 eep(
-3
+1
 0);%0A
@@ -1623,21 +1623,19 @@
 diately(
-5
 0, 
-5
 0, 500, 
@@ -1693,26 +1693,24 @@
 %0A%09%09%09%09%09%09    %7D
-*/
 %0A%09%09%09%09  %7D%0A%09%09%09
@@ -1774,9 +1774,9 @@
 eep(
-6
+7
 0);%0A
@@ -1777,24 +1777,26 @@
 (70);%0A%09%09%09%09%09%09
+//
  app.getView

Tweak tile falling delay