When I have a block that has many null values,such as: [x] [] [] [] [] []
Question:
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!
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr