(Solved) : Submission Submit Mainpy Implementation Mainpy Imagine Building Graphics Engine Mobile Gam Q42741277 . . .

Submission

Submit main.py

Implementation of main.py

    Imagine you are building a graphics engine for amobile gaming studio. You need to use a design pattern to build thefollowing application.

Create three classes: Square, Rectangle, and Triangle. Each willhave a draw function that will print the current location of theshape and print the shape in an ASCII format (see example below).Create a move function that is only defined in the base classcalled Objects. The move function will take two parameters x,y andwill also return the updated x,y parameters.

    obj.move(0, 0)
    obj.draw()
    obj.move(2, 2)
    obj.draw()

The code above should print the output below.

  /
/
/ 0,0
——-
  /
/
/ 2,2

Note that obj can be any of the three classes. You should be ableto specify which of the three classes with a static function calledcreator.

Here’s another example of the code running with Rectangle andTriangle.

    obj = Objects.creator(‘Square’)
    obj.move(2, 0)
    obj.draw()

    obj = Objects.creator(‘Rectangle’)
    obj.move(0, 10)
    obj.draw()

This will produce the following output:

——-
| |
| 2,0 |
| |
——-
——-
| 0,10 |
——-

Expert Answer


Answer to Submission Submit main.py Implementation of main.py Imagine you are building a graphics engine for a mobile gaming studi…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us