Assignment 4: Turtle Graphics Save the World
This collage includes works of art that students in previous CMPT 120 semesters agreed to share with the class (on a different theme).
Explore the turtle drawing package to create your work of art!
For this assignment you need to do some original drawing, made by YOU using Turtles and so that the code follows the specifications below. Be creative, do your own design following the required theme: "UN Sustainable Development Goals".
Required code features
- Construct a scene which is inline with the very general theme of the UN sustainable development goals.
- You may pick any one goal, or multiple goals, and draw a scene that in some way relates to work being done to make the world a better place.
- You can add comments to your program's code, or text to your output, to explain your scene if you like (optional).
- Includes some colour, fill in some area with some colour, changes the pen colour in some parts
- The turtle does at least three visible right or left turns.
- The pen changes from being up to down at least 2 times.
- There should be at least 3 (Python) loops (perhaps many-many more!):
- At least two for-loops: The for loops may be inside or outside a function. The for loops may be nested but do not have to be so.
- At least one while loop: Suggested uses include loop through numbers or elements in a list (replacing a
for
loop, just for practice). You could use the loop to randomly choose colours, or randomly choose the size or location of an object.
- You should define these 4 functions at minimum:
- Two non-fruitful functions (i.e. non-productive) which do drawings and/or pen movements. These functions should have some parameter(s) which provides variation to the function when it is executed. For example, drawing figures of different sizes, or in different locations on the screen.
- One fruitful function (i.e. productive) which returns a random colour as a name (may be randomly extracted from a hardcoded list of colours)
- One fruitful function which returns a random colour as a tuple with three colour components
- TIP: Organize your code by using numerous more function! Put each object you are drawing into its own function to make it easier to rearrange your image.
- The defined functions must actually be called and not just defined (i.e. used and passing arguments to the parameters as needed). In the case of fruitful functions, the values must be captured by the calling statement and the values must be used.
- The drawing includes the first three letters of your first name and the last digit from your student number
- You need to draw the first three letters of your first name and the last digit of your SFU student id, in the bottom right part of your drawing.
- You must achieve this using turtle pen drawing, NOT with text. For example, you may not use
picasso.write(...)
: you must use turtle movements etc. to draw these characters. - The letters and digit may be of any size (as long as they are visible and recognizable) and may additionally appear elsewhere and be artistic.
- You may stamp with your turtle, and with different shapes if desired, but this is optional and involves no points
Enjoy the creative process!
Required code organization
Organize your program as follows:
1) Place the import statements and creation of Turtle objects outside the function definitions, at the beginning of the code, after the program header.
2) Place ALL the functions definitions immediately after that.
3) Then, only after including ALL the function definitions, include the rest of your code (i.e. the code where you call your own defined functions). Functions may call other functions as well. Just remember that functions need to be placed before they are called in the Python file.
Readability Guidelines
- Ensure that there is a comment at the top of the file with
- Description of the file
- Your name & date
- All import statements should be placed at the top of the file, immediately after the header
- Modules should only be included once per file
- Well-named variables (describes their purpose)
- Each line of code should be less than 100 characters
- Group your code into smaller sections or paragraphs, and give each a descriptive comment. Have a blank line between each "paragraph" of code that does one thing. Do not have too many extra blank lines in the code beyond what is reasonably needed for code readability.
Submission
Submit your python file directly to CourSys (don't ZIP it). Do not submit any of the .CSV files.
- NOTE! Make sure that you do NOT name your file 'turtle.py'. This causes errors, making Python lose the ability to use the functions and methods in the turtle module
- Avoid saving your .py program in the Desktop folder. Several students have had problems when running a turtle program saved on desktop.
Submission Notes
- All submissions will be compared for unexplainable similarities. We expect submissions will be somewhat similar for this assignment but do your own original work; we are checking!
- Do not email/give your code to another student. Do not accept code from another student. Do not post your code online.
Troubleshooting Submission Problem
Here are some things to look at if you have challenges submitting:
- When submitting your source code to CourSys, it will enforce that the files have the correct names. Ensure your file names are exactly as expected.
- Ensure your files have a .py file extension.
- After submitting, you can verify if any files were submitted by viewing the assignment page on CourSys. It should allow you to view/download your submission.
Marking Notes
- Code that does not run (i.e., crashes or produces an error stopping the program) then it will get a mark of 0.
- To ensure your code works try to finish early so you can get help from TAs if needed! It is better to submit code that works perfectly but doesn't contain all the features, than one that has all the features (potentially) but crashes.
- Each line of your code should NOT exceed 100 characters. This is to help you develop a habit of good code formatting.
- You could also use intermediate variables to store parts of long messages to be printed (more situations will be seen as the course advances).
- If you are using offline IDEs like VS Code or IDLE, you can look at the bottom of the editor which often tells you how many characters you have typed in a line (as COL's).
- If you are using Replit, first go to Settings on the left panel and set "Wrapping" to "none". Then use this sentence as a guide:
# This line has exactly 100 characters (including the period), use it to keep each line under limit.