{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": false, "editable": false, "run_control": { "frozen": true } }, "source": [ "# Game Assignment Starter Coden", "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_1n", "* room_2n", "* room_3n", "* failn", "n", "Our map can be visualized as follows:n", "<br><br>n", "n", "~~~n", " room_1 –> room_2 –> room_3 (win)n", " | |n", " `———-`——> failn", "~~~n", "n", "<br>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 gamen", "#########################################################n", "n", "def room_1():n", " print("You're in room_1!\n")n", " input('<Press any key to continue>\n')n", " n", "n", "room_1() # This starts the game" ] }, { "cell_type": "markdown", "metadata": { "deletable": false, "editable": false, "run_control": { "frozen": true } }, "source": [ "<hr style="height:.9px;border:none;color:#333;background-color:#333;" />" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "editable": false }, "outputs": [], "source": [ "#########################################################n", "# Adding room_2 and linking it to room_1n", "#########################################################n", "n", "def room_1():n", " print("You're in room_1!\n")n", " input('<Press any key to continue>\n')n", "n", " room_2() # This moves us into room_2n", "n", "n", "def room_2():n", " print("You're in room_2!\n")n", " input('<Press any key to continue>\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": [ "<hr style="height:.9px;border:none;color:#333;background-color:#333;" />" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "deletable": false, "editable": false }, "outputs": [], "source": [ "#########################################################n", "# Adding room_3 and linking it to room_2n", "#########################################################n", "n", "def room_1():n", " print("You're in room_1!\n")n", " input('<Press any key to continue>\n')n", " n", " room_2() # This moves us into room_2n", "n", "n", "n", "def room_2():n", " print("You're in room_2!\n")n", " input('<Press any key to continue>\n')n", " n", " room_3() # This moves us into room_3n", "n", "n", "n", "def room_3():n", " print("You're in room_3! You win!\n")n", " input('<Press any key to exit>\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": [ "<hr style="height:.9px;border:none;color:#333;background-color:#333;" />n", "n", "<br>n", "n", "<h2>Part 2: Adding in a fail function and ways to fail</h2>" ] }, { "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('<Press any key to continue>\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_2n", "n", " elif choice == '2':n", " fail() # This moves us into failn", " n", " else:n", " print("Invalid entry. Please try again.\n")n", " room_1() # Brings us back to the beginning of room_1 to try againn", " n", "n", "n", "def room_2():n", " print("You're in room_2!\n")n", " input('<Press any key to continue>\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_2n", "n", " elif choice == '2':n", " fail() # This moves us into failn", " n", " else:n", " print("Invalid entry. Please try again.\n")n", " input('<Press any key to continue>\n')n", " n", " room_2() # Brings us back to the beginning of room_1 to try againn", "n", "n", "n", "def room_3():n", " print("You're in room_3! You win!\n")n", " input('<Press any key to exit>\n')n", "n", "n", "n", "def fail():n", " print("You've failed, but thanks for playing!")n", " input('<Press any key to exit>\n')n", "n", "n", "room_1() # EVERYTHING goes before this clausen" ] }, { "cell_type": "markdown", "metadata": { "deletable": false, "editable": false, "run_control": { "frozen": true } }, "source": [ "<hr style="height:.9px;border:none;color:#333;background-color:#333;" />n", "n", "<br>n", "n", "<h2>Part 3: Adding more functionality to the game</h2>n", "Let's update our game as follows:n", "n", "* room_1n", " * nested conditionaln", "* room_2n", "* room_3n", " * while loopn", "* failn", "n", "Our game map can be visualized as follows:n", "<br><br>n", "n", "~~~n", " room_1 <–> room_2 <–> room_3 (win)n", " *nc | | *wn", " `———-`——> failn", "~~~n", "n", "<br>" ] }, { "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 coden", "n", "n", "def room_1():n", " print("You're in room_1!\n")n", " input('<Press any key to continue>\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 elephantn", "2) the moonn", " n", """")n", " n", " choice = input("> ")n", " n", " # Start of nested conditionaln", " 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('<Press any key to continue>\n')n", " n", " room_2()n", " n", " # End of nested conditionaln", " n", " n", " elif choice == '2':n", " fail()n", " n", " else:n", " print("Invalid entry. Please try again.\n")n", " input('<Press any key to continue>\n')n", " room_1()n", " n", "n", "n", "def room_2():n", " print("You're in room_2!\n")n", " input('<Press any key to continue>\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 = 3n", " n", " while presses > 0:n", " input('<Press any key>\n')n", " presses -= 1n", " n", " print("You win!")n", "n", "n", "n", "def fail():n", " print("You've failed, but thanks for playing!")n", " input('<Press any key to exit>\n')n", "n", "n", "room_1()" ] }, { "cell_type": "markdown", "metadata": { "deletable": false, "editable": false, "run_control": { "frozen": true } }, "source": [ "<br>" ] } ], "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}
Special-GameStarterCode1.ipynb
Get Your Paper Before the Deadline. Our Services are 100% private and Confidential
Useful Links That Will Help You Around
Link to new order https://studentsolutionsusa.com/orders/stud/new
link to login page https://studentsolutionsusa.com/orders/login
New user registration link https://studentsolutionsusa.com/orders/register
Forgot Password https://studentsolutionsusa.com/orders/forgot/password
FREQUENTLY ASKED QUESTIONS
Question: How does this work?
Answer: Good Question. We are a group of a freelance board of students and professional essay writers. At our website, you may get help with any type of academic assignments: essay, coursework, term paper, business plan, case study, article review, research paper, presentation, and speech. Top writers can help with complex assignments such as dissertations, thesis papers, etc. All of them are professionals possessing excellent knowledge in their field of expertise, perfect writing skills, quality, and speed. When you place an order on our website, we assign it to the best writer. Once the writer finishes the work, the paper is submitted to our quality assurance desk who go through it and ensure it is unique and plagiarism free and that the instructions were followed to the detail. After this step we upload the paper in your account, we also send a copy to the email that you used to register the account with. we can guarantee you that the paper will be 100% plagiarism free. Besides, our services are 100% private and confidential
Question: How do I place an Order after getting to the order page
Answer: There are three major steps in the ordering process
Step 1 ....................................................paper details In this step, you will fill in the instructions of your paper; you can upload any materials that you feel will make your assignment a success. Besides, you can also email us at [email protected] Remember to specify the correct academic level. Please note that sources mean the number of references.
Step 2...................................................... Price calculation Kindly specify the number of pages, type of spacing and the correct deadline. This step will give you the estimated cost minus discount -- you may add the extra features if you wish.
Step 3 ....................................................discount and payment Use the discount code HAPPY2018 to enjoy up to 30% discount of your total cost After this step, proceed to safe payment; you can checkout using your card or PayPal Please note we will send the complete paper to the email you will provide while registering. A copy will also be uploaded to your account
Question: How will I know when my paper is complete? or How will I get the complete Paper?
Answer: Once we are done with the paper, we will be uploaded to your account. A copy will also be sent to the email you registered with. We can guarantee you the following:- 1. Our service is private and confidential; we don't spam or share your contacts with anyone 2. The final paper will be plagiarism free. We will send a Turnitin Report to the email you registered with 3. At our company, willing to do free unlimited revisions until you are satisfied with your paper
Question:- Am a new client, How can I get the guarantee that the paper will be completed and sent to me before my deadline?
Answer: Thank you for expressing your concerns. We would love to have you as our loyal customer. We are certain if we do good work, you will come back for me. Besides, you will give us referrals to your friends and family. For that reason, we can’t fail to deliver your paper within your specified time frame. We will ensure we submit the paper on time so that you can have enough time to go through it, if you have problems with the paper delivered, you can request a free revision. You are entitled to as many revisions as you would wish until you get a paper that satisfies you
Useful Links That Will Help You Around
Link to new order https://studentsolutionsusa.com/orders/stud/new
link to login page https://studentsolutionsusa.com/orders/login
New user registration link https://studentsolutionsusa.com/orders/register
Forgot Password https://studentsolutionsusa.com/orders/forgot/password