Difference between revisions of "CSC111 Final Exam 2015b"
Line 12: | Line 12: | ||
<br /> | <br /> | ||
* Make sure your name is included in the header of your program. | * Make sure your name is included in the header of your program. | ||
− | * Call your program '''final1.py''' | + | * Call your program '''final1.py'''. |
* I only used "red", "orange", "blue", "lightgreen," and "brown" in the program that generated the image above. | * I only used "red", "orange", "blue", "lightgreen," and "brown" in the program that generated the image above. | ||
* Note that the width of the branches are different. If I ask the program to print the width of each branch as it draws them, I get this output (which is truncated, as it gets very long): | * Note that the width of the branches are different. If I ask the program to print the width of each branch as it draws them, I get this output (which is truncated, as it gets very long): | ||
Line 54: | Line 54: | ||
* The leaves have radius 10. The oranges have radius 20. | * The leaves have radius 10. The oranges have radius 20. | ||
<br /> | <br /> | ||
+ | ==Submission== | ||
+ | <br /> | ||
+ | * Submit your program, along with a capture of the image to Moodle, in the Final 1 Program and Final 1 Image sections. If you need help capturing the final image, please visit [http://www.take-a-screenshot.org/ this page]. | ||
+ | * Make sure your program is documented well, and that your name is written at the top of the header. | ||
<br /> | <br /> | ||
=Find the Largest Element of a List of Lists= | =Find the Largest Element of a List of Lists= | ||
Line 60: | Line 64: | ||
<br /> | <br /> | ||
::<source lang="python"> | ::<source lang="python"> | ||
+ | # final2.py | ||
# Display the contents of a list of lists. | # Display the contents of a list of lists. | ||
# It uses the standard Python function type() which can be used to | # It uses the standard Python function type() which can be used to | ||
Line 100: | Line 105: | ||
==Your Assignment== | ==Your Assignment== | ||
<br /> | <br /> | ||
− | Using the program above as inspiration, write a program that contains a recursive function | + | Using the program above as inspiration, write a program called '''final2.py''' that contains a '''recursive''' function called findMax(). Your program will get a list from the user, then it will compute and display the largest element of the list. The list entered by the user may contain sub-lists, as illustrated above. |
<br /> | <br /> | ||
==Additional Information== | ==Additional Information== | ||
<br /> | <br /> | ||
− | The | + | * The lists will contain only integers and possibly other lists. |
+ | * Lists will always include at least 1 integer. | ||
<br /> | <br /> | ||
==Restrictions== | ==Restrictions== | ||
<br /> | <br /> | ||
− | + | You must use the main function shown below in your program: | |
<br /> | <br /> | ||
::<source lang="python"> | ::<source lang="python"> | ||
Line 121: | Line 127: | ||
</source> | </source> | ||
<br /> | <br /> | ||
+ | ==Submission== | ||
+ | <br /> | ||
+ | * Submit your program to the Final PB 2 section on Moodle. | ||
<br /> | <br /> | ||
=Problem 2: Frogger Game= | =Problem 2: Frogger Game= | ||
Line 127: | Line 136: | ||
<br /> | <br /> | ||
(if the video does not show in the page, you can watch it on YouTube: [https://www.youtube.com/watch?v=plgm_p2zAek https://www.youtube.com/watch?v=plgm_p2zAek]) | (if the video does not show in the page, you can watch it on YouTube: [https://www.youtube.com/watch?v=plgm_p2zAek https://www.youtube.com/watch?v=plgm_p2zAek]) | ||
− | Your assignment is to write a program that uses graphics, and that implements the game illustrated in the video, with a few additional features. | + | Your assignment is to write a program called final3.py that uses graphics, and that implements the game illustrated in the video, with a few additional features. |
<br /> | <br /> | ||
− | Note that the cars appearing on the left of the screen in the video, blink. This is a side-effect of the graphics library, and not a | + | Note that the cars appearing on the left of the screen in the video, blink. This is a side-effect of the graphics library, and not a feature of the program. You do not have to emulate this strange behavior. |
<br /> | <br /> | ||
==Frog== | ==Frog== | ||
<br /> | <br /> | ||
[[Image:frog3.gif|right]] | [[Image:frog3.gif|right]] | ||
− | You can use the frog image shown on the right for your game, or use one you will have found on the Web. Or you can draw it using ovals and/or circles. The URL for the image on the right is: [http://cs.smith.edu/dftwiki/images/f/f6/Frog3.gif cs.smith.edu/dftwiki/images/f/f6/Frog3.gif]. If you use your own image, make sure you call it '''Frog3.gif'''. When your program is tested, the Frog3.gif image shown here will be | + | You can use the frog image shown on the right for your game, or use one you will have found on the Web. Or you can draw it using ovals and/or circles. The URL for the image on the right is: [http://cs.smith.edu/dftwiki/images/f/f6/Frog3.gif cs.smith.edu/dftwiki/images/f/f6/Frog3.gif]. If you use your own image, make sure you call it '''Frog3.gif'''. When your program is tested, it will use the Frog3.gif image shown here. You will not be able to upload your own image. |
<br /> | <br /> | ||
==The Banner== | ==The Banner== | ||
Line 195: | Line 204: | ||
==Implementation== | ==Implementation== | ||
<br /> | <br /> | ||
− | * Call your program ''' | + | * Call your program '''final3.py''' |
* You '''must''' use objects to define the cars. | * You '''must''' use objects to define the cars. | ||
* The number of cars used by the program is fixed and does not grow as the game evolves. In the video, the number of cars is 3, but you can use more. When a car disappears on one end of the screen it reappears on the other side, after a short delay. The delay is up to you. | * The number of cars used by the program is fixed and does not grow as the game evolves. In the video, the number of cars is 3, but you can use more. When a car disappears on one end of the screen it reappears on the other side, after a short delay. The delay is up to you. | ||
Line 205: | Line 214: | ||
<br /> | <br /> | ||
* Assuming that your program is well documented, and nicely organized with functions and classes, the following features will be worth various number of points. A grade of 100 will be given to a will documented and organized program that behaves similarly to the game illustrated in the YouTube video, but with two lanes of cars, one lane going left to right, one going right to left. The number of cars must remain constant, and cars disappearing on one end are made to reappear on the other side. | * Assuming that your program is well documented, and nicely organized with functions and classes, the following features will be worth various number of points. A grade of 100 will be given to a will documented and organized program that behaves similarly to the game illustrated in the YouTube video, but with two lanes of cars, one lane going left to right, one going right to left. The number of cars must remain constant, and cars disappearing on one end are made to reappear on the other side. | ||
− | * Banner working correctly: | + | * Banner working correctly: 5 points |
− | * Cars moving off the graphics window and reappearing on the other side: | + | * Cars moving off the graphics window and reappearing on the other side: 5 points. |
− | * Game stopping when the number of life points reaches 0: | + | * Game stopping when the number of life points reaches 0: 5 points |
− | * Frog and car intersection works well: | + | * Frog and car intersection works well: 5 points |
− | * Frog moved back to original position when run over, or when fully crossed: | + | * Frog moved back to original position when run over, or when fully crossed: 5 points |
* Frog moves up and down on mouse clicks: 10 points. | * Frog moves up and down on mouse clicks: 10 points. | ||
<br /> | <br /> | ||
==Submission== | ==Submission== | ||
<br /> | <br /> | ||
− | * Submit your program in the Final | + | * Submit your program in the Final 3 Section area on Moodle. |
</onlydft> | </onlydft> |