To the faculty page of James Tam Return to the course web page

CPSC 217: Assignment 2  ("The Dungeon of Doom": the Inner Sanctum)

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.

Assignment difficulty

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. This requirement exists so you 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, functions not implemented appropriately or insufficiently etc.) then you will not be awarded full credit.

Your program must be decomposed properly into functions. One way of decomposing your program is to include all the instructions needed for a room as a single function (or you can subdivide things further i.e. the code for a room is split between multiple functions). Because there are three rooms that will mean that your program will consist of at least 4 functions (1 per room plus a starting function). You may be able to subdivide your program using an alternate approach to writing 1 function per room but your program must follow [principles of good design for using functions].

New Concepts to be applied for the assignment

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.

Critical design requirements

All instructions must be enclosed within the body of a function, at least 4 functions must be properly defined and follow [good design principles for functions]. No global variables  may be employed. The exceptions to having statements outside of a function: import statements (not really needed for this assignment), the creation of global constants (e.g. ATTIC = 1), a global debugging flag (if you choose to employ one, not mandatory for this assignment) and the call to the initial start or main function.

Functional requirements (working features of your program, for the marks allocated for each feature see the marking spreadsheet):


Living room contents: a pot of soil, stairs going up, a dark entranceway, a ball of a string

(Actions you must implement for the living room).

Attic contents: a tiny hole in the floor, an unlimited supply of cheese, stairs going down.

(Actions you must implement for the attic).

Bedroom contents: a tomcat which is intently watching a mouse hole (default), mouse (after the cat leaves).

(Actions you must implement for the bed room).

As was the case with the previous assignment each room will provide a description of the contents, display a menu of options (which varies depending upon the state of the game), get and error check the player's selection and display the menu and description for the room as long as the player remains in that location.

Game walkthrough: because this program is more complex than the previous one the above summary map cannot provide details of what the player needs to do in order to win the game. Similar to an actual game a text step-by-step walkthrough specifies what's needed to win the game.

  1. Living room: Pick up the ball of string.
  2. Living room: go up the stairs to the attic.
  3. Attic: drop the string down the hole.
  4. Attic: pick up some cheese.
  5. Attic: go down the stairs back to the living room.
  6. Living room: go through the dark entranceway to the bedroom.
  7. Bedroom: Feed the cheese to the mouse.
  8. Bedroom: go through the dark entranceway back to the living room.
  9. Living room: view the pot of soil (and win the game).

Overall program design

function attic()

Do while (player is in the attic)

Display options for attic

Get player's selection

Take appropriate action based upon the selection

End while

end function

 

function bed room()

Do while (player is in the bed room)

Display options for bed room

Get player's selection

Take appropriate action based upon the selection

End while

end function

 

function living room()

Do while (player is in the living room)

Display options for living room

Get player's selection

Take appropriate action based upon the selection

End while

end function

 

function start()

    Do while (game has not yet been won) #Main program loop

        if (location is living room) then

            call function for living room

        end if

        else if (location is attic) then

            call function for attic

        end if

        if (location is bed room) then

            call function for bed room

        end if

    End while

     Run end game instructions

end function

Sample outputs of this program:

You can find sample outputs of my solution to this assignment in a link to this [Link to the folder containing outputs].

In addition to grading on whether the above functionality was correctly implemented TAs will also look at documentation and style.

Non-functional assignment requirements (style and documentation).

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)

  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???

Having at least one violation in one of the above general style requirements 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, messy program layout and poor error handling will receive a -0.3 penalty)

Function specific style requirements (principles of good design for functions) -0.2 penalty will be applied for each of the 3 function specific style requirements that have been violated.

Documentation requirements:

How to do determine 'how you did' on an assignment?

Program functionality (implementing working program features)

Style and documentation (non-functional assignment requirements)

Marking and grading

Collaboration:

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].

Method of submission:

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.

D2L configuration for this course

Late submissions for full assignments  when there is no extension granted: Make sure you give yourself enough time to complete the submission process so you don't get cut off by D2L's deadline (or your submission will be automatically flagged as late by D2L and it will be graded appropriately).

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)

 

General use of pre-created Python libraries:

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() - the latter is actually not actually a function but a composite type such as string or a list but it looks like a function. 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.

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.