To the faculty page of James Tam | Return to the course web page |
Due at 4 PM. For assignment due dates see the main schedule on the course webpage. The program must be written and run under python version 3.X.
Students may find assignments more challenging than they first thought. It's best to start work as early as possible. Tips in the very first lecture were provided but here's two reminders: 1) work through the lecture and tutorial material before looking in detail at the assignments 2) start work as soon as possible. If you find you cannot complete an assignment before the due date then you will not be granted an extension.
Note: it is not sufficient to just implement a working program and expect full credit. You need to implement your solution in the correct way using good design principles and you apply the necessary concepts. Even if your program is fully working and the program is not designed or implemented as specified in the assignment description (e.g. poor variable names used, named constants not used when they should have employed etc.) then you will not be awarded full credit. For some assignments your grade may be greatly reduced. For example, in all the later assignments you need to employ functional decomposition and do so in a the specified manner. If you do not do this for these later assignments then your maximum assignment grade point could be as low as 1.0 GPA even with a fully working program. So you should carefully read the specific details provided in each assignment which is provided under the ["Marking and grading"] section of each 'full' assignment. The marking of the mini-assignments will focus on program functionality unless otherwise specified.
Only new concepts that need to be applied in the assignment are listed, concepts previously applied in other assignments may need to used in the implementation of your solution.
Write a text-based "choose your own" adventure game.1 There will be three 'rooms' in the game world, within each room the player will see a number of choices with the program will reacting to the player's choice. The game will repeatedly run the game via a main loop (contains most of the instructions of the program) that runs until the game has been won.
Pseudo code design for the main loop
Do while (game has not yet been won)
#Instructions for playing the game (i.e. almost all of the program the program)
End while
#Display conclusion with a congratulatory message.
The goal of this game is to open the locked door inner (by changing the positions of the two locks located in different parts of the game) to access the rest of the house. When the door has been unlocked the player can return to the entrance room and open the locked door. When this occurs the main loop ends and a suitable congratulatory message should be displayed and the program ends.
Entrance room description
The player begins the game in the entrance. The door that brought the person into the house is gone (it's a "one-way portal"). When the player is in this room the game will describe the list of possible actions (for consistency do not deviate too much from the text below).
- Try to open the door (result depends upon whether the door is locked)
- Go through the left entryway (takes the player to the pantry)
- Go through the right entryway (takes the player to the kitchen)
The selections in the menu should be logical and easy to understand: What the user needs to enter for options when choosing the above options need to be intuitive. E.g. selecting '1' for opening the door, '2' for going left and '3' for going right doesn't make it easy for the player to associate a menu selection with each action. Designing a program with such poor mappings may result in a lower grade. (For ideas on better mappings look at the output file: ["output_normal_play.txt"])
The player cannot open the inner door until it has been unlocked. The player can freely pass through either entryway with no conditions. Entering a non-existent selection will result in a suitable helpful error message (refer to the last section of the 'repetition' notes, the [usability heuristics] which are rules of thumb for designing a user-friendly program) and the above options are displayed again. As long as the player remains in the room the program will repeatedly display the above menu options (using a loop) after the user enters a selection.
Pseudo code algorithm for the entranceway
Do while (player is in the entranceway)
Display options for entranceway
Get player's selection
Take appropriate action based upon the selection
End whilePantry description
As shown in the above map the player can freely pass between the entrance and the pantry. When the player is in the pantry, the game will display the list of possible actions (for consistency do not deviate too much from the text below).
- Turn the silver lock to the left position
- Turn the silver lock to the right position
- Turn the silver lock to the center position
- Don't change the position! Return to entranceway
The program must show the current position of the lock e.g. "The silver lock is currently set to the right position.". The starting default is the 'left' position. (The unlocked position is 'right'). Similar to the entrance if the player enters an invalid selection in the pantry, a suitable helpful error message should be displayed and the list of options for the pantry will be shown again. As long as the player remains in the room the program will repeatedly display the above menu options (using a loop) after each time the user enters a selection. [The menu selections for choosing the action for this room need to be intuitive].
Pseudo code algorithm for the pantry
Do while (player is in the pantry)
Display options for pantry
Get player's selection
Take appropriate action based upon the selection
End while
As shown in the above map the player can freely pass between the entrance and the kitchen. When the player is in the kitchen, the game will display the list of possible actions (for consistency do not deviate too much from the text below).
The program must show the current lock position e.g. "The gold lock is currently set to the center position." The starting default is the 'center' position. (The unlocked position is 'left'. Similar to the entrance if the player enters an invalid selection in the kitchen, a suitable helpful error message should be displayed and then the list of options for the kitchen will be shown again. As long as the player remains in the room the program will repeatedly display the above menu options (using a loop) after each time that the user enters a selection. [The menu selections for choosing the action for this room need to be intuitive].
Pseudo code algorithm for the kitchen
Do while (player is in the
kitchen)
Display options for kitchen
Get player's selection
Take appropriate action based upon
the selection
End while
A text file ["
Overall program design: here is all the pseudo-code for the entire program.
Do while (game has not yet been won)
Do while (player is in the entranceway)
Display options for entranceway
Get player's selection
Take appropriate action based upon the selection
End while
Do while (player is in the kitchen)
Display options for kitchen
Get player's selection
Take appropriate action based upon the selection
End while
Do while (player is in the pantry)
Display options for pantry
Get player's selection
Take appropriate action based upon the selection
End while
End while
Instructions that display conclusion with a congratulatory message.
In addition to grading on whether the above functionality was correctly implemented, markers will also look at style and documentation (non-functional assignment requirements):
General programming style requirements (-0.1 penalty for each violation of a category 7 categories of penalties means a maximum penalty of -0.7 will be applied). Having at least one violation in one of the above categories will result in -0.1 penalty to marking. Multiple violations in one category still results in a single penalty (e.g. 3 bad variable names will still result in a -0.1 penalty). However violations between categories will result in cumulative penalties (e.g. a program that includes poor variable names, named constants weren't used when they should have been, menu options are non intuitive will receive a -0.3 penalty).
- #1: Naming conventions: You should employ good naming conventions for identifiers (variables, constants) as covered in the "Intro to programming" section of the course. Also note there is a specific name that you should give to the file containing your program which is specified under the [marking and grading section].
- #2: Named constants should be used as appropriate (and if they aren't employed a penalty will be incurred).
Yes do it this way! No. Not this way! LEFT = 0
RIGHT = 1
CENTER = 2
if (silverLockPosition == RIGHT):if (silverLockPosition == 0): #What does 0 stand for???
- #3: The program code should have appropriate white space (specified in the "Intro to programming lecture") and alignment (specified throughout the lecture notes).
- #4: Code is self documenting e.g. Clear expressions (e.g. mathematical, Boolean). Expressions should be clear and simple (break up or restructure complex expressions). Good variable names and the use of named constants are examples of writing self documenting code but naming conventions is important enough to warrant a separate category.
- #5: Your program should follow the 6 rules of thumb for designing user friendly software (distilled from Jakob Nielsen's 10 usability heuristics - see the Usability Heuristics in the [Part III of the looping/repetition notes]). e.g. good error handling (such as prompts to the user to enter the required information clearly indicate what is required, good error messages/error handling should be provided for erroneous input) minimizing the user's memory load, being consistent, making the interactions with the program (the "dialog") as simple and as natural as possible, providing clearly marked exits & providing feedback as appropriate. This includes but is not limited to having the menu selections for choosing the action for each room being intuitive.
- #6: Of course if a student implements an extreme case of inefficient code (e.g. multiple loops or branches are used when one will do) then penalties may be applied but this is generally rare i.e. it has to be really bad to warrant a penalty.
- #7: The program should not employ abnormal termination mechanisms e.g. something such as a 'break' instruction for loops or calls to the 'exit()', 'quit()' functions anywhere in the program.
Python documentation: there's two forms required.
Header documentation:
This should be specified in the header of the program (very top of your program before any instructions). The basics of documentation were covered in the [last part of the "Intro to programming"] section of the course. Later lectures may specify additional information that needs to be provided in the documentation.
- Identifying information: All assignments should include contact information (full name, student ID number and tutorial section. Here's a link to [PeopleSoft] if you don't know how to find this information.
- Program version. (version date or version number).
- Under the version quickly summarize which assignment features were implemented in that version as specified in the [last part of the "Intro to programming"] section of the course.
- Each room should list the features of that room (from the assignment description) that were correctly implemented.
- Any program limitations or weaknesses i.e. how "not use" the program, what cases or situations that the program cannot handle, what features may be missing (future implementation).
Inline documentation:
It includes more specific details that the header documentation. While the header may specify in generic terms the features of the program implemented (e.g. can change the silver lock position), with the inline documentation for the first assignment you specify greater details about the features of each room near the code for that room (e.g. Pantry inline documentation indicates these features were completed: can change the silver lock to the left, right and center position, the current position is specified for as long as the player is in the room).
Do while (game has not yet been won)
# Inline documentation for the entranceway
Do while (player is in the entranceway)
Display options for entranceway
Get player's selection
Take appropriate action based upon the selection
End while
# Inline documentation for the kitchen
Do while (player is in the kitchen)
Display options for kitchen
Get player's selection
Take appropriate action based upon the selection
End while
# Inline documentation for the pantry
Do while (player is in the pantry)
Display options for pantry
Get player's selection
Take appropriate action based upon the selection
End while
Program functionality (refers to working program features)
Test your program: Because the [marking criteria] is posted ahead of time if you test your program thoroughly before submitting the final version then you should get a pretty clear idea of "how you will do".
Style and documentation (non-functional assignment requirements)
- Style and documentation requirements were introduced early in the semester in the [last part of the "Intro to programming"] section of the course. Additional requirements may be added as new sections are covered (e.g. documenting functions that you write your yourself). Each assignment will specify these requirements specific [under the non -functional assignment requirements (style and documentation). ] to that graded component. Again you should refer to the [marking criteria] in order to determine how style and documentation will affect grading for a particular assignment.
Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others. Some obviously "do nots" for your solution: don't publically post it, don't email it out, don't show it to other students nor should you verbally discuss it. For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
Reminder: You are to submit your assignment using D2L Here's a UC-IT created [D2L help resource] . Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version, it is the correct file etc.). It's your responsibility to do this! (Make sure that you submit your assignment with enough time before it comes due for you to do a check). If don't check and there were problems with the submission then you should not expect that you can "learn your lesson" and simply resubmit Whatever you submitted into D2L by the final due date (and due time) is what will be marked.
Submission received: |
On time |
Hours late : >0 and <=24 |
Hours late: >24 and <=48 |
Hours late: >48 and <=72 |
Hours late: >72 and <=96 |
Hours late: >96 |
Penalty: |
None |
-1 GPA |
-2 GPA |
-3 GPA |
-4 GPA |
No credit (not accepted) |
Unless otherwise told you are to write the code yourself and not use any pre-created functions (or methods). For most assignments the usual acceptable functions include: print(), input() and the 'conversion' functions such as int(), float(), str(), range(). Look at the particular assignment description for a list of other functions/methods that you are allowed to use and still get credit in an assignment submission. If it's not listed then you should assume that you won't be able use the function and still be awarded credit.
1 Choose your own adventure. Rather than passively reading through a fixed story written by the author a choose your own adventure puts you in the role of the story's protagonist whereby you can determine the outcome of the story by choosing at various points the direction that will be taken by the story.