You are going to create a blockmanager class to handle your


Game Description

As the game progresses, columns of three different symbols (such as differently-colored blocks) appear, one at a time, at the top of the playing area and fall to the bottom, landing either on the floor or on top of previously-fallen "columns". While a column is falling, the player can move it left and right, and can also cycle the positions of the symbols within it. After a column lands, if three or more of the same symbols are connected in a horizontal, vertical, or diagonal line, those symbols disappear. The pile of columns then settles under gravity. If this resettlement causes three or more other symbols to align, they too disappear and the cycle repeats.

Problem Specification

You are going to create a BlockManager class to handle your block bookkeeping. You will demonstrate its functionality in a BlockManagerTest class. (You likely will want some additional classes/interfaces to accomplish this, but I leave that design up to you.) The BlockManager should be independent of any future GUI code.

BlockManager

Although the actual game will have a fixed board size, your class should be able to handle arbitrary positive values for the number of rows and columns.

Your class must provide the following functionality.
- Construct a new manager with given number of rows and columns.
- Generate random column pieces using some number of symbols.
o The final game will use random pieces, but for this test program you should have reproducible results each time it is run.
o One simple way to have "random" behavior that can be repeated is to use a Random object that has been initialized with a fixed seed.
- Override toString to provide a string representation of your board.
- Add a new piece to the board in a specific column position. Determine which blocks will be part of a horizontal, vertical, and/or diagonal line of at least 3 blocks of the same color.
- Remove blocks from the board and drop pieces.
o Given a line (or lines) of matching blocks, remove them from the board.
o Any blocks above the removed blocks should fall down to fill the empty space.
o Check for any matching lines formed as a result.
BlockManagerTest
The purpose of this testing class is to demonstrate to us that your block manager works correctly, so you need to put it through its paces.
o You should create at least two BlockManager objects with separate sizes and symbols. Demonstrate that they operate independently of each other. (I want to make sure that you aren't locked in to just one configuration and that you aren't making things static inappropriately.)
o Test adding columns and dropping blocks on each manager.
- Print out the string representation of the manager before you begin. - Add a new piece to the board.

1. Print out the block manager after the addition.

2. Print out how many blocks are in lines and should be removed. (May be zero if there are no lines formed by the drop.)

3. Remove the matching lines and drop blocks.

4. Print out the resulting block manager.

5. Print out how many blocks need to be removed as a result of new matching lines formed by the dropped blocks.

6. Repeat from 3 until no more matches are formed.

7. Add more pieces. Don't use the same position or piece every time. Demon- strate horizontal, vertical, and diagonal matches. Demonstrate lines formed by dropped blocks.
- After demonstrating each manager, repeat the tests with the first manager again to prove that it is independent of the second.
- Don't just copy and paste the same test code for each manager. Structure your code sensibly with methods rather than writing one giant main method.
- Your testing output should come from BlockManagerTest, not BlockManager. Don't put console output in the middle of your block manager logic.
- I am providing you with example output from my testing code to give you an idea what I'm expecting this to look like.

Attachment:- output.rar

Solution Preview :

Prepared by a verified Expert
JAVA Programming: You are going to create a blockmanager class to handle your
Reference No:- TGS02381748

Now Priced at $15 (50% Discount)

Recommended (96%)

Rated (4.8/5)