This is an individual assignment. You must submit your own work. This assignment has three goals:
- Analyzing requirements and developing a solution
- Reviewing python constructs including., if, if-else, if-elif-else, loops, and functions
- Practicing basic python programming
Start the assignment early and avoid procrastination.
For this assignment, you develop a turn-based game where you control a blue turtle, Alex, to chase and catch a red turtle, Alice. Create a canvas (also known as screen) of size 500 x 500. Alex must appear at the middle of the canvas. Alice appears at a random location inside the canvas.
In each turn, Alice can move either forward by 20 pixels or she can change her direction randomly to left or right by 90 degrees. 2/3 of Alice’s movements should be forward movements and 1/3 should be the random direction changing left or right.
Alex moves as directed by the player using the keyboard. In each turn, the buttons w, a, s, and d lead Alex to move forward for 30 pixels, turn left for 45 degrees, back for 30 pixels, and right for 45 degrees, respectively. If Alex or Alice cross the canvas’s boundaries, they should reappear at a random1 location on the canvas. The game statistic needs to be provided on the screen as shown in the sample. The game ends if Alex comes within 30 pixels of Alice in any direction. See figure 2 to get an idea of how the game will look like.
In order to receive a complete grade no global variable or codes outside functions should be in your program. Create a main function and control the program by calling other functions through main. The program starts with calling main() only. Use constants instead of magic numbers. Follow variable name conventions all through your code and be consistence. Use white lines to separate blocks of codes.
Name your program ChasingAlice.py then submit it to the D2L Assignment 2 dropbox by the deadline stated at the top of this document.
This is an individual assignment and all work that you submit must be your own work. We encourage you to discuss this assignment with other students in the course and discourage you from sharing solutions and code with one another. Sharing solutions and code is a form of plagiarism.
We use automated procedures to detect plagiarism in assignment submissions. Any student who copies all or part of an assignment that belongs to another student or other sources will be reported to the Dean. The Dean enforces penalties, which may include failing the course and expulsion from the faculty and the university. Please refer to Plagiarism/Cheating/Other Academic Misconduct in the university calendar or the university website on plagiarism for more information.