Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

When I have a block that has many null values,such as: [x] [] [] [] [] [] [] [] [] I want the block to

When I have a block that has many null values,such as: [x] [] [] [] [] [] [] [] [] I want the block to go right since there are no tiles to prevent this move how can i do that?

public void setTile(int y, int x, Tile t){

if (y >= 0 && y < board.size() && x >= 0 && x < board.get(y).size()) {

board.get(y).set(x, t);

}

}

public Tile getTile(int y, int x){

// return board.get(y).get(x);

if (y >= 0 && y < board.size() && x >= 0 && x < board.get(y).size()) {

return board.get(y).get(x);

} else {

throw new RuntimeException("Invalid indices provided for getTile");

}

}

public int getY()

{

return y;

}

public int getX()

{

return x;

}

public int getWidth(){

return board.size()>0?board.get(0).size():0;

}

public int getHeight(){

return board.size();

}

public static boolean moveRight(Board bd, Block bk)

{ } help me please!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

1292016922, 978-1292016924

More Books

Students also viewed these Algorithms questions