Write a java application called newtetristhat

Assignment Help Basic Computer Science
Reference no: EM13307058

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.

Reference no: EM13307058

Questions Cloud

How many days will contractor require to complete the work : A contractor has both a 3-cy and a 5-cy shovel in the equipment fleet. Select the minimum-size shovel that will excavate 400,000 bcy of common earth in a minimum of 130 working days of 8 hr each.
Egyptians buried with books of going forth by day : Why were Egyptians buried with Books of Going Forth by Day (Books of the Dead)?
What is the lowest maximum cycle temperature at the engine : the pressure ratio across the compressor is 9 and the maximum temperature is 827c.the turbine and comprssor processes are adiabatic with turbine efficiency of 90% and a compressor efficiency of 85%.
Using jk flip-flops design : Using JK Flip-Flops, design and implement a 6-bit shift register with the following  operating features. On receipt of a clock pulse it:
Write a java application called newtetristhat : 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.
Most basic architectural technique for spanning space : What is the most basic architectural technique for spanning space?
What is the new rotational rate : A record (mass 100g and radius 12cm) is rotating at a rate of 33rpm. What is the new rotational rate if angular momentum is conserved
Calculate the maximum temperature and maximum pressure : in an air standard otto cycle , the air at the beginning of the compression stroke is at 95 kpa and 22c ,and the cylinder volume is 0.0028 m^3 . the compression ratio is 9 and 4.3 kj are added during the heat addition process
Restraining forces in human capital management : How do you see human resource professionals impacting the driving and restraining forces in human capital management to support a competitive advantage for your industry or organization

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Generate profits often referred to as creating

When the output of some units can be used as inputs to othe units, or if two organizations pools markets and expertise that results in lower costs and generate profits it is often referred to as creating?

  Explain how objects are created in java

Explain how objects are created in Java and how the memory used by objects is recovered. Compare this to object creation and destruction in C++.

  Identify three operational applications for airlines company

For an airlines company, identify three operational applications that would feed into the data warehouse. What would be the data load and refresh cycles for each

  Provide example of a business networking scenario

Provide example of a business networking scenario

  Compute the cost of sorting the relation in seconds

Suppose a flash storage device is used instead of disk, and it has a seek time of 1 microsecond and a transfer rate of 40 MB per second. Recompute the cost of sorting the relation in seconds with.

  Write a class encapsulating a course

write a class encapsulating a course. Where a course is assumed to have three attributes: a code name, a description and number of credits.

  Create an applet to draw a digit using the method fillrect

In Java Programming, Create an applet to draw a digit using the method fillRect of the class Graphics. For instance, if the input is 4, the applet will display the digit 4. I will also need the HTML code along with the code

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

  Determine enterprisesystem possible without virtuaalization

determine whether or not you believe that enterprise systems would have been possible without virtualization. Provide at least three reasons to support your position.

  Explain limitations of operations research technique

Describing your selected operations research technique. You must explain the technique, assumptions and limitations of method, the kinds of problems

  Explaining seven steps of information gathering

Write and explain the seven steps of information gathering.

  Write structured english for clyde-s narrative policies

Lasting more than one day, we permit hotel, taxi, and airfare, also meal allowances. Same times apply for meal expenses." Write down structured English for Clyde's narrative of reimbursement policies.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd