Question: PLEASE TRANSLATE TO PLAIN ENGLISH IN A SEQUENCE LISTING STEP BY STEP WHAT IS HAPPENING. THANK YOU! Please only answer if you understand it and

PLEASE TRANSLATE TO PLAIN ENGLISH IN A SEQUENCE LISTING STEP BY STEP WHAT IS HAPPENING. THANK YOU! Please only answer if you understand it and can explain it.

BACKGROUND KNOWLEDGE: We are making a board with a Model, View, and Controller

Public Tile class {

int row, col, color;

}

Public tile (int r, int c)

Declare row;

Declare col;

Declare color;

}

Class Board {

Create 2D array;

board needs to know the tile location

}

Public board (int r, int c) {

Declare rows;

Declare cols;

Ask tile [ x ] [ y ] for color

Initialize board;

}

Public void initialize board ( ){

do{

for loop initialize i to zero, if row is less than rows, increment by one;

for loop initialize i to zero, if col is less than cols, increment by one;

tile [ x ] [ y ] equals new tile;

} while not isMoveAvailable;

}

Public Boolean isMoveAvailable( ){

For loop {

To set color, tiles [r] [c] gets [specific color];

Store tile matches in hash table;

Locate neighbors (row, col, color, matches);

If match size is greater or equal to certain number return true

}

Otherwise return false;

}

Public void locateNeighbor(int row, int col, int color, Hashset matches){

Indicate what position tile b is at;

If matches has tile b{

Return;

} else{

Add tile b to matches;

}

If (isNorthMatches(row,col,color)

Locate neighbor and go to the row above;

locateNeighbor(row+1, col, color, matches);

If (isSouthMatches(row,col,color)

Locate neighbor and go to the row below;

locateNeighbor(row-1, col, color, matches);

If (isEastMatches(row,col,color)

Locate neighbor and go to the col right;

locateNeighbor(row, col +1, color, matches);

If (isWestMatches(row,col,color)

Locate neighbor and go to the col left;

locateNeighbor(row, col-1, color, matches);

}

public boolean isNorthMatches(int row, int col, int color){

if (row>=0 && row<= rows-2 && tiles[row+1][col] != null && tiles[row+1][col].getColor() = color)

return true;

else

return false

}

public boolean isSouthMatches(int row, int col, int color){

if (row>=0 && row<= rows-2 && tiles[row-1][col] != null && tiles[row-1][col].getColor() = color)

return true;

else

return false

}

public boolean is WestMatches(int row, int col, int color){

if(col >= 0; col <= cols -2 && Tiles [row][col +1] !null && Tiles[row][col+1].getColor() = color)

return true;

eelse

return false;

}

public boolean is EastMatches(int row, int col, int color){

if(col >= 0; col <= cols -2 && Tiles [row][col -1] !null && Tiles[row][col-1].getColor() = color)

return true;

else

return false;

}

personTouches(x, y){

color = b.getColor( x, y)

Hashset matches = new hashset ( );

locateNeighbor(x, y, color, matches);

if (matches.Tile) >= 3){

b.explode(matches);

}

Public void explode (Hashset Matches){

Null tiles(matches)

Collapse col;

Fill col;

}

Main java{

Public state void main(){

NewgameController();

}

}

Public class GameController{

GameView gameview;

Public gameController(){

Java.awt.EventQue. invokelater (new punnable(i)){

Public void run(){

gameView = new GameView (Buster, 8,8, new newGameListen); gameView.setVariables(true);

}

}

}

Class newGameListener implementActionListerner{

Public void action proformed(ActionEvent current){

System.out.print /n (you clicked new game);

gameView.newGasme();

}

}

}

Package view;

Public class GameView Extends Iframe{

ScoreView scoreView;

ButtonView buttonView;

BoardView boardView;

Int rows, cols;

Public scoreView ( ){

Int width, length;

New scoreView;

}

Public buttonView( ){

Int width, length;

New buttonView;

}

Public boardView( ){

Int width, length;

New boardView;

}

Public GameView (string tile, int row, int col ,ActionListener NewGame){

this.rows = rows;

this.cols = cols;

this.tile = tile;

New GameListener = gameListener;

Jbutton b;

b = new IButton (New Game);

b.addActionListener(newGameListener);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!