1. Homepage
  2. Programming
  3. COMP 110 EX06: Choose Your Own Adventure

COMP 110 EX06: Choose Your Own Adventure

Engage in a Conversation
PythonIntro to Programming and Data ScienceCOMP 110Choose Your Own AdventureUS

COMP 110 EX06 - Choose Your Own Adventure

Overview Background Lessons Getting Started Specifications CourseNana.COM

  1. Required Global variables (10 points total):
  2. main function (10 points total):
  3. greet procedure and welcome message (15 points total):
  4. At least one custom procedure (15 points total):
  5. At least one custom function (15 points total):
  6. Game loop (10 points total):
  7. Misc. Requirements (15 points total): Rubric
  8. Make a Backup Checkpoint “Commit” Submission Instructions

In the first open-ended programming exercise, you will create a text-driven, “Choose Your Own Adventure” experience. CourseNana.COM

This exercise will need to satisfy many specifications, so before you begin programming be sure to read this exercise’s write-up in full. CourseNana.COM

You are free to use your imagination to design and implement any experience you would like, as long as it meets the requirements. For some inspiration, here are some example ideas the UTA team and I came up with, if you are not feeling the spark of creativity: CourseNana.COM

  1. Taking care of a virtual pet like a tamagotchi. You are free to introduce additional variables, global or otherwise, for keeping track of a pet’s health.
  2. Some kind of role playing game where you choose what kinds of attacks or defenses to use and the opposing creature randomly chooses theirs. Points could be health or damage inflicted.
  3. A number guessing game such as the generating a random number and asking the user to guess it and counting the number of attempts it takes them to guess it correctly.
  4. A “buzzfeed quiz” that determines which Disney Princess character are (or anything else).
  5. A coinflip guessing game where you have to choose heads or tails and see how many you can guess in a row correctly.
  6. Some kind of mystery that involves searching a sequence of rooms.
  7. Something heavily emoji based, perhaps as surprising as a Japanese Game Show
  8. A parody of something that is poignant satire (a student once made a ConnectCarolina registration parody that was pure, comedic gold)

Again, feel encouraged to come up with an idea that is uniquely your own! CourseNana.COM

Background Lessons

The conceptual purpose of the game is to help you practice the concepts you have learned up to this point and explore some additional, related topics, including: CourseNana.COM

  1. String Escape Sequences (for Emoji!)
  2. String Interpolation (better than concatenation!)
  3. Named Constants
  4. Global Variables

As background preparation for this exercise, you should first complete the following lessons linked below: CourseNana.COM

  1. Strings
  2. Scopes, Constants, Globals

Getting Started

In your workspace’s exercises directory, create a file named cyoa.py for this Choose Your Own Adventure experience. Begin by defining a main procedure that serves as the “entrypoint” to the program. The initial call to main should be found at the end of your program, following Python’s idiom: CourseNana.COM

if __name__ == "__main__":
main()

Specifications

These are the requirements for this exercise. Please read them in full and have a rough plan for how you will satisfy them all, before you begin working on it. CourseNana.COM

0. Required Global variables (10 points total):

0.0 Establish a global variable named points to track “adventure points”. How you choose to use these adventure points is up to you. Initialize your global points variable from within your main function. (5 points – autograded) 0.1 Establish a global variable named player to track the player’s name. (5 points – autograded) These variables must have an explicit type declaration. CourseNana.COM

1. main function (10 points total):

1.0 Define a main function, that returns None, and follows the Python idiom for calling main at the end of the program based on the dunderscore variable name being equal to "main". (5 points – autograded) 1.1 After greeting the player using a call to the greet procedure, your main function should enter your experience. You should present the player with at least three options of where to go next and ask them to choose one. One of the three options should be to end the experience and print a goodbye message that includes the number of “adventure points” they accumulated in the experience. The other options should result in function calls which set the user off in different directions on the adventure. You will need to define appropriate functions for these distinct paths. (5 points – hand graded) CourseNana.COM

2. greet procedure and welcome message (15 points total):

2.0 Define a procedure, meaning a function that returns None, named greet. (5 points – autograded) CourseNana.COM

2.1 The greet function must print a welcome message to give some context to your game and asks the player for their name. You should call this procedure at the beginning of your main procedure. (5 points – autograded) CourseNana.COM

2.2 The greet function should assign the name input by the user to the global variable named player. (5 points – hand graded) CourseNana.COM

3. At least one custom procedure (15 points total):

One of the possible directions the player is set off in from main must be a procedure call. (Again, a procedure is a function that returns None.) CourseNana.COM

3.1 The procedure should lead to textual interaction(s) that make use of players name and ask the player for additional input. (10 points – hand graded) CourseNana.COM

3.2 The procedure should have logic to reassign the points global variable directly based on the user’s choices. At a minimum, increase the adventure’s points each time the player makes a choice. (5 points – hand graded) CourseNana.COM

What happens within this procedure is up to you and you are free for this procedure call to lead to others, make use of loops, and so on. Get creative! CourseNana.COM

4. At least one custom function (15points total):

One of the other possible directions the player can choose to set off in from main should be a call to a function that takes an integer as a parameter and returns an integer. CourseNana.COM

4.1 The function takes at least one int as a parameter and returns an int. The call to this function from main should pass the player’s points value as an argument to the function call. (5 points – hand graded) CourseNana.COM

4.2 Like the previous procedure, you should make use of the player name in some output and have the user make at least one interaction choice that results in the points parameter (local variable) changing. Ultimately, this function should return the player’s total points after any interactions it leads to. (5 points – hand graded) CourseNana.COM

4.3 The main function should use the returned value to update the global variable points. (5 points – hand graded) CourseNana.COM

Note: Requirements 3 and 4 are intentionally asking you to implement the same kinds of behavior but using two very different strategies in code for achieving them. The strategy in #3 relies on global variables shared between the main procedure and the function(s) you write. The strategy in #4 avoids the function(s) from directly accessing or reassigning the points global variable. There are trade-offs to each strategy. It is valuable to think through the trade-offs of both! CourseNana.COM

5. Game loop (10 points total):

5.0 Introduce a “game loop” in your main function. The game loop should allow the user to continue your experience and choose the same initial branch, or another branch, or to stop playing. Before looping, each time, you should update the user on their total number of points. (You should NOT use the exit() function for this.) (10 points – hand graded) CourseNana.COM

6. Misc. Requirements (15 points total):

6.0 You must make use of f-strings (formatted string literals) described in lecture 6 to produce any output that would otherwise require concatenation. (5 points – hand graded) CourseNana.COM

6.1 You must define at least one global NAMED_CONSTANT and assign it the unicode escape sequence "\U00000000" for each Emoji you use. Strings such as these are considered “magic numbers”, too! You are encouraged to make liberal use of Emoji throughout your adventure, they are fun! (5 points – hand graded) CourseNana.COM

6.2 At least one path in your adventure must incorporate some element of randomness from the random library. (5 points – hand graded) CourseNana.COM

Note: Your program should not have any global calls to the input function. Any user prompting/interaction should be inside of a function. If you get an OSError from the grader, double check you have no global input calls and that your idiom is set up correctly per the “Getting Started” section above. CourseNana.COM

Rubric

5 Points - Static Type Checks 5 Points - Linting 10 Points - player and points global variables correctly declared 10 points - main function allows user to choose one of three options 15 Points - greet function meets specification #2 above 15 Points - Procedure meeting specification #3 above 15 Points - Function meeting specification #4 above 10 Points - Game loop (with no use of exit() function) 5 Points - Used at least one emoji and setup a named constant for it 5 Points - Used f-strings for building string outputs rather than concatenation 5 Points - Incorporated randomness CourseNana.COM

3. Make a Backup Checkpoint

“Commit” As you make progress on this exercise, making backups is encouraged. Note that you do not have to make a backup in order to submit your work, though you are encouraged to before each submission so that you can revert back to a previous point in your project if you accidentally change something you did not intend to. CourseNana.COM

  1. Open the Source Control panel (Command Palette: “Show SCM” or click the icon with three circles and lines on the activity panel).
  2. Notice the files listed under Changes. These are files you’ve made modifications to since your last backup.
  3. Move your mouse’s cursor over the word Changes and notice the + symbol that appears. Click that plus symbol to add all changes to the next backup. You will now see the files listed under “Staged Changes”. If you do not want to backup all changed files, you can select them individually. For this course you’re encouraged to back everything up.
  4. In the Message box, give a brief description of what you’ve changed and are backing up. This will help you find a specific backup (called a “commit”) if needed. In this case a message such as, “Progress on Exercise 2” will suffice.
  5. Press the Check icon to make a Commit (a version) of your work.
  6. Finally, press the Ellipses icon (…), look for “Pull/Push” submenu, and select “Push to…”, and in the dropdown select your backup repository.

Submission Instructions

To prepare your scene for submission, be sure to add a docstring to your module (at the top of the file) and a global author variable set to a string which contains your 9-digit PID. Linting will also look for docstrings in your function definitions, per usual. 35 points of this assignment will be autograded, and the remaining 65 hand-granded. CourseNana.COM

Run python -m tools.submission exercises/cyoa.py to build your submission zip for upload to Gradescope. Don’t forget to backup your work by creating a commit and pushing it to GitHub. For a reminder of this process, see the previous exercises. CourseNana.COM

NOTE: If you’re running into a Gradescope error No such file or directory: 'exercises/cyoa.py', make sure cyoa.py is under exercises not project CourseNana.COM

Contributor(s): Kris Jordan © 2023 Kris Jordan - Feedback Form - Made with CourseNana.COM

in Chapel Hill CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Python代写,Intro to Programming and Data Science代写,COMP 110代写,Choose Your Own Adventure代写,US代写,Python代编,Intro to Programming and Data Science代编,COMP 110代编,Choose Your Own Adventure代编,US代编,Python代考,Intro to Programming and Data Science代考,COMP 110代考,Choose Your Own Adventure代考,US代考,Pythonhelp,Intro to Programming and Data Sciencehelp,COMP 110help,Choose Your Own Adventurehelp,UShelp,Python作业代写,Intro to Programming and Data Science作业代写,COMP 110作业代写,Choose Your Own Adventure作业代写,US作业代写,Python编程代写,Intro to Programming and Data Science编程代写,COMP 110编程代写,Choose Your Own Adventure编程代写,US编程代写,Pythonprogramming help,Intro to Programming and Data Scienceprogramming help,COMP 110programming help,Choose Your Own Adventureprogramming help,USprogramming help,Pythonassignment help,Intro to Programming and Data Scienceassignment help,COMP 110assignment help,Choose Your Own Adventureassignment help,USassignment help,Pythonsolution,Intro to Programming and Data Sciencesolution,COMP 110solution,Choose Your Own Adventuresolution,USsolution,