public void consolidate(Block block) // when the dropping block has reached its final location,//this method will consolidate it into the tetris well -- O(block_size)     public void clearRows() // clear any/all rows that are complete and shifts the above tiles down -- O(board_size)     public void reward() // applies the reward as explained in the project description -- O(board_size)     public void penalize() // applies the penalty as explained in the project description -- O(board_size) help me please

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

public void consolidate(Block block) // when the dropping block has reached its final location,//this method will consolidate it into the tetris well -- O(block_size)

    public void clearRows() // clear any/all rows that are complete and shifts the above tiles down -- O(board_size)

    public void reward() // applies the reward as explained in the project description -- O(board_size)

    public void penalize() // applies the penalty as explained in the project description -- O(board_size)

help me please

class Board
This class represents the two-dimensional well of the tetris (the top-left corner of the board has coordinates 0,0). It is practically a placeholder for the tiles of the blocks that consolidate into the well when the drop stops. However, this well is dynamic and can change its content when certain moves on the block are
made:
public class Board{
public Board (int height, int width)
{
Every time the player scales up the block, the player is rewarded with one row of tiles being removed from the board. The row to be removed is the row with the highest number of consolidated tiles. In case of a tie, remove the lowest row.
Every time the player scales down the block, the player is penalized with an incomplete row inserted to the board. The row to be inserted is a duplicate of the row having the fewest consolidated tiles (in case of a tie, pick the
}
this.board = new DynamicArray<>(height);
for(int y = 0;y<height;y++){
}
DynamicArray<Tile> row = new DynamicArray<>(width);
for(int x = 0; x<width;x++){
row.set(x, null);
}
board.set(y, row);
}
public int getWidth()
{
if(board.size() < 0){
return 0;
}
return board.get(0).size();
Transcribed Image Text:class Board This class represents the two-dimensional well of the tetris (the top-left corner of the board has coordinates 0,0). It is practically a placeholder for the tiles of the blocks that consolidate into the well when the drop stops. However, this well is dynamic and can change its content when certain moves on the block are made: public class Board{ public Board (int height, int width) { Every time the player scales up the block, the player is rewarded with one row of tiles being removed from the board. The row to be removed is the row with the highest number of consolidated tiles. In case of a tie, remove the lowest row. Every time the player scales down the block, the player is penalized with an incomplete row inserted to the board. The row to be inserted is a duplicate of the row having the fewest consolidated tiles (in case of a tie, pick the } this.board = new DynamicArray<>(height); for(int y = 0;y<height;y++){ } DynamicArray<Tile> row = new DynamicArray<>(width); for(int x = 0; x<width;x++){ row.set(x, null); } board.set(y, row); } public int getWidth() { if(board.size() < 0){ return 0; } return board.get(0).size();
}
public int getHeight()
{
}
public void setTile(int y, int x, Tile t)
wwwd
{
if (y >= 0 && y < board.size() && x >= 0 && x < board.get(y).size()) {
board.get(y).set(x, t);
}
return board.size();
}
}
public Tile getTile(int y, int 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");
}
Transcribed Image Text:} public int getHeight() { } public void setTile(int y, int x, Tile t) wwwd { if (y >= 0 && y < board.size() && x >= 0 && x < board.get(y).size()) { board.get(y).set(x, t); } return board.size(); } } public Tile getTile(int y, int 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"); }
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

where is the remove function?

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Software Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education