Python for Data Analysts: Methods & Tools

Text Adventure Game Development

In this assignment, students are tasked with designing a

text-based adventure game Links to an external site.

. This game should utilize the Python essentials covered thus far, including, but not limited to:

  • Strings and String Manipulation
  • User-Defined Functions and Objects (variables)
  • User Input and Input Handling
  • Conditional and Nested Conditional Statements (if/elif/else)
  • Loops (for/while)
  • Controlling for Errors (try/except)

The working version of the game should include:

An executable script (a script that runs from beginning to end upon execution) that includes:

  • a game that can be successfully completed within a maximum of 3 minutes (i.e., you can win the game in 3 minutes or less)
  • for a passing grade, your text adventure game must include a minimum of:

    3 stages (maximum of 5 stages)
    5 defined variables
    1 list
    1 for loop
    1 while loop
    3 nested conditional statements (all must include an else clause)
    1 win() function (Executed whenever a user wins the game. There must be only one win function)
    1 fail() function (Executed whenever a user loses the game. There must be only one fail function)

  • A description at the beginning of game that:

    Is no more than 300 words
    Introduces the story, game, and its objective
    Identifies any bugs that are not yet worked out

Requirements and Restrictions

  • Your game must be based on a book, movie, or TV show. Make sure to provide a source in A.P.A. format.
  • The only programming language you may use is Python (no JavaScript, C, or other languages are allowed).
  • Global variables may NOT be used (avoid things such as combat engines and/or character attributes such as health points).
  • No use of class structures or other object-oriented programming structures (you must stick to user-defined functions).
  • You are not allowed to pass things between the stages of your game (stages should not inherit arguments from other stages; no optional or mandatory arguments). For example, a key found in Stage 1 cannot be carried forward to Stage 2. However, you can statically write this into your text if it is required for your story.

Deliverables

  • A working version of your game in the following format:

    Jupyter Notebook (.ipynb format)

    One markdown cell containing the description
    One code cell containing the game (points will be deducted if the submission contains more than one code cell)

  • The code submitted as a .txt file (copy/paste the code into a .txt file). Points will be deducted if the submission is not a .txt file.

{
“cells”: [
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [
“# Game Assignment Starter Code\n”,
“\n”,
“The purpose of this code is to demonstrate how to construct a structure based on a game map. In this starter code, we will assume that we have three rooms on our game map. The assignment requirements also specify that we have a fail function. Therefore, we will be creating a simple skeleton containing the following elements:\n”,
“* room_1\n”,
“* room_2\n”,
“* room_3\n”,
“* fail\n”,
“\n”,
“Our map can be visualized as follows:\n”,

\n”,
“\n”,
“~~~\n”,
” room_1 –> room_2 –> room_3 (win)\n”,
” | |\n”,
” `———-`——> fail\n”,
“~~~\n”,
“\n”,

\n”,
“\n”,
“## Part 1: Building up one room at a time (no fail function)”
]
},
{
“cell_type”: “code”,
“execution_count”: null,
“metadata”: {
“deletable”: false,
“editable”: false
},
“outputs”: [],
“source”: [
“#########################################################\n”,
“# Constructing room_1 and calling it to start the game\n”,
“#########################################################\n”,
“\n”,
“def room_1():\n”,
” print(\”You’re in room_1!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
“\n”,
“room_1() # This starts the game”
]
},
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [



]
},
{
“cell_type”: “code”,
“execution_count”: null,
“metadata”: {
“deletable”: false,
“editable”: false
},
“outputs”: [],
“source”: [
“#########################################################\n”,
“# Adding room_2 and linking it to room_1\n”,
“#########################################################\n”,
“\n”,
“def room_1():\n”,
” print(\”You’re in room_1!\\n\”)\n”,
” input(‘\\n’)\n”,
“\n”,
” room_2() # This moves us into room_2\n”,
“\n”,
“\n”,
“def room_2():\n”,
” print(\”You’re in room_2!\\n\”)\n”,
” input(‘\\n’)\n”,
“\n”,
” \n”,
“room_1() # Calling the first function in our map will start our game”
]
},
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [



]
},
{
“cell_type”: “code”,
“execution_count”: null,
“metadata”: {
“deletable”: false,
“editable”: false
},
“outputs”: [],
“source”: [
“#########################################################\n”,
“# Adding room_3 and linking it to room_2\n”,
“#########################################################\n”,
“\n”,
“def room_1():\n”,
” print(\”You’re in room_1!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” room_2() # This moves us into room_2\n”,
“\n”,
“\n”,
“\n”,
“def room_2():\n”,
” print(\”You’re in room_2!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” room_3() # This moves us into room_3\n”,
“\n”,
“\n”,
“\n”,
“def room_3():\n”,
” print(\”You’re in room_3! You win!\\n\”)\n”,
” input(‘\\n’)\n”,
“\n”,
“room_1() # Calling the first function in our map will start our game”
]
},
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [


\n”,
“\n”,

\n”,
“\n”,

Part 2: Adding in a fail function and ways to fail


]
},
{
“cell_type”: “code”,
“execution_count”: null,
“metadata”: {
“deletable”: false,
“editable”: false
},
“outputs”: [],
“source”: [
“def room_1():\n”,
” print(\”You’re in room_1!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” print(\”Press 1 to go to room_2.\”)\n”,
” print(\”Press 2 to fail.\”)\n”,
” \n”,
” choice = input(\”> \”)\n”,
” \n”,
” if choice == ‘1’:\n”,
” room_2() # This moves us into room_2\n”,
“\n”,
” elif choice == ‘2’:\n”,
” fail() # This moves us into fail\n”,
” \n”,
” else:\n”,
” print(\”Invalid entry. Please try again.\\n\”)\n”,
” room_1() # Brings us back to the beginning of room_1 to try again\n”,
” \n”,
“\n”,
“\n”,
“def room_2():\n”,
” print(\”You’re in room_2!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” print(\”Press 1 to go to room_3.\”)\n”,
” print(\”Press 2 to fail.\”)\n”,
” \n”,
” choice = input(\”> \”)\n”,
” \n”,
” if choice == ‘1’:\n”,
” room_3() # This moves us into room_2\n”,
“\n”,
” elif choice == ‘2’:\n”,
” fail() # This moves us into fail\n”,
” \n”,
” else:\n”,
” print(\”Invalid entry. Please try again.\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” room_2() # Brings us back to the beginning of room_1 to try again\n”,
“\n”,
“\n”,
“\n”,
“def room_3():\n”,
” print(\”You’re in room_3! You win!\\n\”)\n”,
” input(‘\\n’)\n”,
“\n”,
“\n”,
“\n”,
“def fail():\n”,
” print(\”You’ve failed, but thanks for playing!\”)\n”,
” input(‘\\n’)\n”,
“\n”,
“\n”,
“room_1() # EVERYTHING goes before this clause\n”
]
},
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [


\n”,
“\n”,

\n”,
“\n”,

Part 3: Adding more functionality to the game

\n”,
“Let’s update our game as follows:\n”,
“\n”,
“* room_1\n”,
” * nested conditional\n”,
“* room_2\n”,
“* room_3\n”,
” * while loop\n”,
“* fail\n”,
“\n”,
“Our game map can be visualized as follows:\n”,

\n”,
“\n”,
“~~~\n”,
” room_1 <--> room_2 <--> room_3 (win)\n”,
” *nc | | *w\n”,
” `———-`——> fail\n”,
“~~~\n”,
“\n”,


]
},
{
“cell_type”: “code”,
“execution_count”: null,
“metadata”: {
“deletable”: false,
“editable”: false,
“scrolled”: true
},
“outputs”: [],
“source”: [
“## Tip ##\n”,
“# make sure to make ample comments throughout your code\n”,
“\n”,
“\n”,
“def room_1():\n”,
” print(\”You’re in room_1!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” print(\”Press 1 to go to room_2.\”)\n”,
” print(\”Press 2 to fail.\”)\n”,
” \n”,
” choice = input(\”> \”)\n”,
” \n”,
” if choice == ‘1’:\n”,
” print(\”Then you must answer this question.\\n\”)\n”,
” \n”,
” print( \n”,
“\”\”\”\n”,
“What’s bigger, an elephant or the moon?\n”,
“1) an elephant\n”,
“2) the moon\n”,
” \n”,
“\”\”\”)\n”,
” \n”,
” choice = input(\”> \”)\n”,
” \n”,
” # Start of nested conditional\n”,
” if choice == ‘1’:\n”,
” print(\”That’s incorrect.\”)\n”,
” \n”,
” fail()\n”,
” \n”,
” \n”,
” \n”,
” elif choice ==’2′:\n”,
” print(\”That’s correct! Please enjoy room_2!\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” room_2()\n”,
” \n”,
” # End of nested conditional\n”,
” \n”,
” \n”,
” elif choice == ‘2’:\n”,
” fail()\n”,
” \n”,
” else:\n”,
” print(\”Invalid entry. Please try again.\\n\”)\n”,
” input(‘\\n’)\n”,
” room_1()\n”,
” \n”,
“\n”,
“\n”,
“def room_2():\n”,
” print(\”You’re in room_2!\\n\”)\n”,
” input(‘\\n’)\n”,
” \n”,
” print(\”Press 1 to go to room_3.\”)\n”,
” print(\”Press 2 to fail.\”)\n”,
” \n”,
” choice = input(\”> \”)\n”,
” \n”,
” if choice == ‘1’:\n”,
” room_3()\n”,
“\n”,
” elif choice == ‘2’:\n”,
” fail()\n”,
” \n”,
” else:\n”,
” print(\”Invalid entry. Please try again.\\n\”)\n”,
” room_2()\n”,
“\n”,
“\n”,
“\n”,
“def room_3():\n”,
” print(\”You’re in room_3!\\n\”)\n”,
” print(\”All you have to do to win is press any key three times.\\n\”)\n”,
” \n”,
” presses = 3\n”,
” \n”,
” while presses > 0:\n”,
” input(‘\\n’)\n”,
” presses -= 1\n”,
” \n”,
” print(\”You win!\”)\n”,
“\n”,
“\n”,
“\n”,
“def fail():\n”,
” print(\”You’ve failed, but thanks for playing!\”)\n”,
” input(‘\\n’)\n”,
“\n”,
“\n”,
“room_1()”
]
},
{
“cell_type”: “markdown”,
“metadata”: {
“deletable”: false,
“editable”: false,
“run_control”: {
“frozen”: true
}
},
“source”: [


]
}
],
“metadata”: {
“kernelspec”: {
“display_name”: “Python 3”,
“language”: “python”,
“name”: “python3”
},
“language_info”: {
“codemirror_mode”: {
“name”: “ipython”,
“version”: 3
},
“file_extension”: “.py”,
“mimetype”: “text/x-python”,
“name”: “python”,
“nbconvert_exporter”: “python”,
“pygments_lexer”: “ipython3”,
“version”: “3.8.5”
},
“toc”: {
“base_numbering”: 1,
“nav_menu”: {},
“number_sections”: false,
“sideBar”: true,
“skip_h1_title”: false,
“title_cell”: “Table of Contents”,
“title_sidebar”: “Contents”,
“toc_cell”: false,
“toc_position”: {},
“toc_section_display”: true,
“toc_window_display”: false
},
“varInspector”: {
“cols”: {
“lenName”: 16,
“lenType”: 16,
“lenVar”: 40
},
“kernels_config”: {
“python”: {
“delete_cmd_postfix”: “”,
“delete_cmd_prefix”: “del “,
“library”: “var_list.py”,
“varRefreshCmd”: “print(var_dic_list())”
},
“r”: {
“delete_cmd_postfix”: “) “,
“delete_cmd_prefix”: “rm(“,
“library”: “var_list.r”,
“varRefreshCmd”: “cat(var_dic_list()) ”
}
},
“types_to_exclude”: [
“module”,
“function”,
“builtin_function_or_method”,
“instance”,
“_Feature”
],
“window_display”: false
}
},
“nbformat”: 4,
“nbformat_minor”: 2
}

Calculate the price of your order

Select your paper details and see how much our professional writing services will cost.

We`ll send you the first draft for approval by at
Price: $36
  • Freebies
  • Format
  • Formatting (MLA, APA, Chicago, custom, etc.)
  • Title page & bibliography
  • 24/7 customer support
  • Amendments to your paper when they are needed
  • Chat with your writer
  • 275 word/double-spaced page
  • 12 point Arial/Times New Roman
  • Double, single, and custom spacing
  • We care about originality

    Our custom human-written papers from top essay writers are always free from plagiarism.

  • We protect your privacy

    Your data and payment info stay secured every time you get our help from an essay writer.

  • You control your money

    Your money is safe with us. If your plans change, you can get it sent back to your card.

How it works

  1. 1
    You give us the details
    Complete a brief order form to tell us what kind of paper you need.
  2. 2
    We find you a top writer
    One of the best experts in your discipline starts working on your essay.
  3. 3
    You get the paper done
    Enjoy writing that meets your demands and high academic standards!

Samples from our advanced writers

Check out some essay pieces from our best essay writers before your place an order. They will help you better understand what our service can do for you.

  • Analysis (any type)
    Advantages and Disadvantages of Lowering the Voting Age to Thirteen
    Undergrad. (yrs 1-2)
    Political science
    APA
  • Coursework
    Leadership
    Undergrad. (yrs 1-2)
    Business Studies
    APA
  • Essay (any type)
    Is Pardoning Criminals Acceptable?
    Undergrad. (yrs 1-2)
    Criminal Justice
    MLA

Get your own paper from top experts

Order now

Perks of our essay writing service

We offer more than just hand-crafted papers customized for you. Here are more of our greatest perks.

  • Swift delivery
    Our writing service can deliver your short and urgent papers in just 4 hours!
  • Professional touch
    We find you a pro writer who knows all the ins and outs of your subject.
  • Easy order placing/tracking
    Create a new order and check on its progress at any time in your dashboard.
  • Help with any kind of paper
    Need a PhD thesis, research project, or a two-page essay? For you, we can do it all.
  • Experts in 80+ subjects
    Our pro writers can help you with anything, from nursing to business studies.
  • Calculations and code
    We also do math, write code, and solve problems in 30+ STEM disciplines.

Frequently asked questions

Get instant answers to the questions that students ask most often.

See full FAQ
  • Is there a possibility of plagiarism in my completed order?

    We complete each paper from scratch, and in order to make you feel safe regarding its authenticity, we check our content for plagiarism before its delivery. To do that, we use our in-house software, which can find not only copy-pasted fragments, but even paraphrased pieces of text. Unlike popular plagiarism-detection systems, which are used by most universities (e.g. Turnitin.com), we do not report to any public databases—therefore, such checking is safe.

    We provide a plagiarism-free guarantee that ensures your paper is always checked for its uniqueness. Please note that it is possible for a writing company to guarantee an absence of plagiarism against open Internet sources and a number of certain databases, but there is no technology (except for turnitin.com itself) that could guarantee no plagiarism against all sources that are indexed by turnitin. If you want to be 100% sure of your paper’s originality, we suggest you check it using the WriteCheck service from turnitin.com and send us the report.

  • I received some comments from my teacher. Can you help me with them?

    Yes. You can have a free revision during 7 days after you’ve approved the paper. To apply for a free revision, please press the revision request button on your personal order page. You can also apply for another writer to make a revision of your paper, but in such a case, we can ask you for an additional 12 hours, as we might need some time to find another writer to work on your order.

    After the 7-day period, free revisions become unavailable, and we will be able to propose only the paid option of a minor or major revision of your paper. These options are mentioned on your personal order page.

  • How will I receive a completed paper?

    You will get the first version of your paper in a non-editable PDF format within the deadline. You are welcome to check it and inform us if any changes are needed. If everything is okay, and no amendments are necessary, you can approve the order and download the .doc file. If there are any issues you want to change, you can apply for a free revision and the writer will amend the paper according to your instructions. If there happen to be any problems with downloading your paper, please contact our support team.
  • Where do I upload files?

    When you submit your first order, you get a personal account where you can track all your orders, their statuses, your payments, and discounts. Among other options, you will have a possibility to communicate with your writer via a special messenger. You will be able to upload all information and additional materials on your paper using the “Files” tab on your personal page. Please consider uploading everything you find necessary for our writer to perform at the highest standard.
See full FAQ

Take your studies to the next level with our experienced specialists

Live Chat+1 (857) 777-1210 EmailWhatsApp