Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Write a Java application called NewTetristhat allows a new way to play Tetris. It is well known that in Tetris there are seven kinds of tetriminos, each of which is made up of four minos.The application window is divided into three bands: top, middle and bottom. When the application starts, seven different tetriminos will appear within the top band, as shown in the Java applet below. These seven tetrinimos are referred to as model tetriminos. A user can add tetriminos into the middle band tocreate a meaningful shape. A tetrimino that is no longer useful can be deleted byputting it into the bottom band.

Specifically, a user can perform the following four operations to create a meaningful shape in the middle band.

  • Add: to add a tetrimino, a user can use the left mouse button to drag the corresponding model tetrimino located within the top band. When a model tetrimino is selected to be dragged, a duplicate is made out of the model. It is the duplicate that is actually dragged. The model tetrimino stays at the same location.

  • Move: To move a duplicate tetrimino, use the left mouse button to drag it. The model tetrimino can't be moved.

  • Rotate: To rotate a duplicate tetrimino, use the right mouse button to click one of its four minos. Please note the tetrimino will rotate about the center of the mino that is clicked. The model tetrimino can't be rotated.

  • Delete: at the end of the moving or rotating operation, if the tetrimino intersects with the bottom band, the tetrimino will be deleted. Since a model tetrimino can't be moved or rotated, it can't be deleted.

     

    Requirements/Recommendations:

    • You shall write a class named CMino to describe a mino.

    • You shall write a class named CTetriMino to describe seven different tetriminos.

    • You can use collections to keep a record of all the tetriminos added so far.

    • Use event handlers to add, move, rotate and delete a tetrimino.

    • After rotating a point (x1, y1) about another point (x0, y0) counterclockwise through an angle of theta in radians, its new location (x2, y2) can be represented as follows.

      • x2=x0+(x1-x0)*cos(theta)-(y1-y0)*sin(theta)

      • y2=y0+(x1-x0)*sin(theta)+(y1-y0)*cos(theta)

 

Next:

Extend the NewTetris application completed in Project #2 to be a two-user network application that allows two users on two different machines to play the NewTetris game together. Both users have their own application windows on their own machines. Whatever one user has performed an operation within his/her window will be immediately reflected on the window of the other user too. Therefore both windows will show exactly the same tetrimino collection.

Difficulty: this is a typical distributed computing project. The difficulty is how to handle the conflicting operations simultaneously performed by the two users. For example, what to do when two users want to drag the same tetrimino at the same time? At the minimum, you can assume that the users will make sure no conflicting operations will be performed by themselves. If you choose to implement an advanced solution, please describe your idea in the email message body. Up to ten (10) bonus points will be awarded if you have successfully implemented an advanced solution to the conflicting operation problem.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9886379
  • Price:- $70

Guranteed 36 Hours Delivery, In Price:- $70

Have any Question?


Related Questions in Computer Engineering

Question suppose that new more powerful arithmetic

Question : Suppose that new, more powerful arithmetic instruction are added to the instruction set. On average, through the use of these more powerful arithmetic instructions, we can reduce the number of arithmetic instr ...

Command to mail only the process id of running java program

Command to mail only the process ID of running Java program test to the email address (single line Unix)

The following is historical data on the us dollar -

The following is historical data on the U.S. dollar - Canadian dollar exchange rate: Date U.S./Canadian  Canadian/U.S. 1/20/2016 0.68 1.46 9/6/2018 0.76 1.32 Calculate the percentage change in the exchange rate over this ...

Research current literature to identify a recent project

Research current literature to identify a recent project that has combined the processing capacity of numerous small computers to address a problem. Identify the operating system used to coordinate the processors for thi ...

Serializationdesign a verilog module to convert a 64-bit

Serialization Design a Verilog module to convert a 64-bit data signal with periodic timing (eight-cycle period) into a series of eight-bit signals with periodic timing (one-cycle period). You must store the input data, a ...

Question 1 describe the components and basic requirements

Question: 1. Describe the components and basic requirements for creating an audit plan for an IT Infrastructure Audit. 2. Using the National Institute of Standards and Technology (NIST) IT security controls, what is incl ...

A small library keeps a roster of who will be at the desk

A small library keeps a roster of who will be at the desk each day. They have a database table as shown below. Week Start___Mon___Tue____Wed_____Thur____Fri 17/10/2011 -- Jane -- Sue -- George -- Sue -- Jane 24/10/2011 - ...

Why software is important in our lifesearch the internet

Why Software is important in our life? Search the internet for "Why Software is important in our life" Read about this topic and write an essay of around 500 words and submit it.

A chemistry student needsnbsp550 gnbspof dimethyl sulfoxide

A chemistry student needs 55.0 g of dimethyl sulfoxide for an experiment. By consulting the  CRC Handbook of Chemistry and Physics , the student discovers that the density of dimethyl sulfoxide is 1.10 g.cm^-3. Calculate ...

Question suppose you are developing a program that

Question : Suppose you are developing a program that frequently tests whether a student is in a soccer team, what is the best data structure to store the students in a soccer team? Justify your answer.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As