Create an interactive forest drawing application

Assignment Help Other Subject
Reference no: EM132739350

Forest Drawing

TASK
In this assignment you will use turtle graphics to create an interactive forest drawing application.
Start by creating a module ‘utilities.py' which should contain four drawing functions as listed below.
• draw_triangle(centre_x, centre_y, width, height, pen_color,
• fill_color)
• draw_rectangle(centre_x, centre_y, width, height, pen_color,
• fill_color)
• draw_circle(centre_x, centre_y, radius, pen_color, fill_color)
• stamp_turtle(centre_x, centre_y, color)
The parameter names are self-explanatory. For example, the draw_triangle() function should draw an upwards pointing triangle with (centre_x, centre_y) located as shown in figure.

Additionally the module should also contain these functions:
• distance(X1, Y1, X2, y2) - to find the Cartesian distance between two points

(X1, Y1) and (X2, Y2)
• save_state() and restore_state() - the former should save turtle's important parameters (position, pen color, fill color) in global (module-level) variables. The latter function will reload the turtle's state from those same variables. The four drawing functions listed above should call these save and restore functions before and after a drawing respectively so that turtle's state is restored to same values as it was before a drawing.
In your main file ‘forest.py' you should import the utilities module and call its functions to do all drawings. No direct drawing should be needed from main file.
At the program start, you should disable all turtle animations and change the turtle's icon to a bird shape (see sample code). Then turtle should be hidden from view. Next your program should implement the following requirements.
• Create a large rectangle to represent drawing boundary.
• On top of the rectangle, draw two small circles and write text to let the user choose between a bird and tree drawing. When the program starts, tree must be chosen by default.
• Handle mouse clicks in the turtle window. Clicks within the drawing rectangle will draw a tree or bird depending on user's selection. Mouse clicks outside the drawing rectangle are ignored, except for those within the selection circles which switch the drawing mode from bird to tree.
• Drawing a tree consists of drawing one vertical rectangle (stem) and three overlapped triangles (branches and leaves).
• The bird on the other hand should be drawn using turtle stamping at the click point.
• Tree size should change randomly. First you will choose a reference size for tree components (stem rectangle and leave triangles). Then at the drawing time, generate a random value between 0.7 and 1.3 which will act as a scale factor so that individual trees can be shorter, equal to or bigger than the reference size.

• When the bird mode is selected, the (bird shaped) turtle becomes visible in the top left corner. When tree mode is selected, turtle hides itself again.
• While the bird mode is selected, your program should respond to left (?) and right (?) keyboard buttons. User will press these buttons in order to change the turtle's tilt angle. By changing the title angle, birds can be drawn in many different orientations.

Your assignment should consist of following tasks.

Task 1
Draw a flowchart of your handle_click() function, including flowcharts for all other functions that are called by handle_click.

You can draw the flowcharts with a pen/pencil on a piece of paper and scan it for submission, as long as the handwriting is clear and legible. However, it is strongly recommended to draw flowcharts using a drawing software.

Task 2
Select four sets of test data that will demonstrate the 'normal' operation of your program; that is, test data that will demonstrate what happens when a valid input is entered. Select three sets of test data that will demonstrate the 'abnormal' operation of your program. Please note that for this application, user input includes mouse clicks as well as keyboard button presses.
Set out test results in a tabular form as follows. It is important that the output listings (i.e., screenshots) are not edited in any way.

Task 3
Implement your program in Python. Comment on your code as necessary to explain it clearly.
Run your program using the test data you have selected and complete the final column of test data table above.
Your submission will consist of:

1. Your algorithm through flowchart/s
2. The table recording your chosen test data and results
3. Source code for your Python implementation
Thus your directory for Assignment will at least contain two or three files (depending on whether you put the flowchart and the test table in the same file).
It is critically important that your test runs are unmodified outputs from your program, and that these results should be reproducible by the marker running your saved .py python program.

RATIONALE
This assessment task will work towards assessing the following learning outcome/s:
• be able to analyse the steps involved in a disciplined approach to problem- solving, algorithm development and coding.
• be able to demonstrate and explain elements of good programming style.
• be able to identify, isolate and correct errors; and evaluate the corrections in all phases of the programming process.
• be able to interpret and implement algorithms and program code.
• be able to apply sound program analysis, design, coding, debugging, testing and documentation techniques to simple programming problems.
• be able to write code in an appropriate coding language.

Attachment:- Forest Drawing.rar

Reference no: EM132739350

Questions Cloud

How the activity will contribute to the learner literacy : Explain why you chose the activity, who you consulted with when designing the activity, how you will set up the environment, how you will involve and interact.
Which is not part of the accounting cycle : Which is not part of the accounting cycle? Classifying and summarizing the effects of the transactions on the accounting elements.
Celanese approach to it service improvement : Do you agree with his characterization of the Celanese and the ITIL path? Why? Why not? repharse the answer and add my point of view
Which transaction will increase the owner equity : Which transaction will increase the owner's equity? Collection from a client to apply on his open balance. / Service rendered to the client on account basis
Create an interactive forest drawing application : Draw a flowchart of your handle_click() function, including flowcharts for all other functions that are called by handle_click - create an interactive forest
Average number of customers waiting in line : A vending machine dispenses hot chocolate or coffee. Service time is 25 seconds per cup and is constant. Customers arrive at a mean rate of 57 per hour
Contrast the operations infrastructures : The Internet has drastically changed the way in which customers interact with businesses.
What is supply chain inventory control : What is Supply Chain Inventory Control, choose a type of business you preferred to have in the future and then select two Inventory Techniques
How much was the recovery from accounts : If the company reported doubtful accounts expense at P195,000, how much was the recovery from accounts that were previously written off

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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