I need to have my programming project completed quick.

The project must be done in python and it must run. 

Get Help With a similar task to - I need to have my programming project completed quick.

Login to view and/or buy answers.. or post an answer
Additional Instructions:

Python Coding Standards Naming Conventions · Use meaningful variable names!! · For example, if your program needs a variable to represent the radius of a circle, call it radius, not r and not rad. · The use of obvious, common, meaningful abbreviations is permitted. For example, ‘number’ can be abbreviated as num as in num_students. · The use of single letter variables is forbidden except in loops. · Begin variable and function names with lowercase letters. · Names of constants should be in all caps with underscores between words. · e.g., EURO_TO_USD = 1.20 or MAX_NUM_STUDENTS = 100 · Separate “words” within identifiers (function names and variable names) with underscores eg., grand_total (Fun fact: this is called snake case because it makes the variables look kinda like snakes!) · Do not use global variables! Use of global variables is forbidden. Use of Whitespace The prudent use of whitespace goes a long way to making your program readable. Horizontal whitespace (spaces between characters) will make it easier to read your code. Vertical whitespace (blank lines between lines of code) will help you to organize it. · Use a single blank line to separate major parts of a function. · Use two blank lines to separate functions. · Indentation should be 4 spaces long. Using Tab in emacs will accomplish this. · Use spaces around all operators. · For example, write x = y + 5, NOT x=y+5. · Lines of code should be no longer than 79 characters (the default size of an emacs window). Code that “wraps” around a line is difficult to read. Line Length Avoid lines of code longer than 79 characters, since they’re not handled well by many terminals, and often make your code more difficult to read. If a line of your code is longer than 80 characters, you may be doing too much in one line of code, or you may have nested too deep with loops and conditionals. If you have a line of code that is unavoidably longer than 79 characters, you can continue the code on the next line by putting a “\” (backslash) after a breakpoint in the code (e.g., after a “+”, after a comma, etc.). If you’re using emacs, it will automatically indent the rest of the line of code following the backslash. For example: choice = int(input("Please enter a number between " + str(min n) + " and " + str(maxx) + ", inclusive: ")) Can become: choice = int(input("Please enter a number between " + \ str(minn) + " and " + str(maxx) + ", inclusive: ")) Sample Code """ File: lab2.py Author: YOUR NAME Date: THE DATE Lab Section: YOUR LAB Section Email: YOUREMAIL@umbc.edu Description: This program shows the layout of code in a Python file, and greets the user with the name of the programmer """ TOTALLY_NORMAL_HUMAN_NAME = "Yxcronor" def where_is_the_cat(cat, location_tried): """ A function to look for the cat :param cat: the name of the cat to look for :param location_tried: the integer IDs I'll look in :return: the integer ids for places I looked """ print("I don't know,", TOTALLY_NORMAL_HUMAN_NAME) return location_tried if __name__ == '__main__': # introduces the programmer print("Hello, my name is perfectly reasonable. \ Say, do you know where the cat is?") where_is_the_cat("Jules", [1, 2]) Use of Constants To improve readability, you should use constants whenever you are dealing with hard-coded values. Your code shouldn't have any “magic numbers,” or numbers whose meaning is unknown. Your code should also avoid “magic strings,” or strings that have a specific use within the program (e.g., choices a user could make such as “yes,” “STOP”, etc.). For example: total = subtotal + subtotal * .06 In the code above, .06 is a magic number. What is it? The number itself tells us nothing; at the very least, this code would require a comment. However, if we use a constant, the number's meaning becomes obvious, the code becomes more readable, and no comment is required. Constants are typically declared near the top of the program so that if their value ever changes they are easy to locate to modify. Constants may be placed before the if __name__ == "__main__": statement – this makes them global constants, which means everything in the file has access to them. (Global variables are only allowed for constants!) Here’s the updated code: TAX_RATE = .06 if __name__ == '__main__': # lots of code goes here total = subtotal + subtotal * TAX_RATE # other code goes here print("Maryland has a sales tax rate of", TAX_RATE, "percent") Comments Programmers rely on comments to help document the project and parts of the project. Generally, we categorize comments as one of three types: 1. File Header Comments 2. Function Header Comments 3. In-Line Comments (1) and (2) will use triple quotes (""") A.K.A. docstrings. (3) will use pound signs (#). 1. File Header Comments Every file should contain a comment at the top describing the contents of the file and other pertinent information. This "file header comment" MUST include the following information. · The file name · Your name · The date the file was created · Your section number · Your UMBC e-mail address · A brief description of the contents of the file For example: """ File: lab2.py Author: YOUR NAME Date: THE DATE Lab Section: YOUR LAB Section Email: YOUREMAIL@umbc.edu Description: This program shows the layout of code in a Python file, and greets the user with the name of the programmer """ 2. Function Header Comments Every single function must have a header comment that includes the following: · A description of what the function does · :param parameter_name (name, type and short description) · :return: description of what is returned For example: def where_is_the_cat(cat, location_tried): """ A function to look for the cat :param cat: the name of the cat to look for :param location_tried: the integer IDs I'll look in :return: the integer ids for places I looked """ print("I don't know,", TOTALLY_NORMAL_HUMAN_NAME) return location_tried 3. In-Line Comments In-line comments are comments within the code itself. They are normally comments for the line(s) of code directly below them. Well-structured code will be broken into logical sections that perform a simple task. Each of these sections of code (often starting with an 'if' statement, or a loop) should be documented. · Any “confusing looking” code should also be commented. · Do not comment every line of code. Trivial comments (e.g., # increment x ) clutter up your code and are worse than no comments at all. · In-line comments are used to clarify what your code does, not how it does it. An in-line comment appears above the code to which it applies. It is also indented to the same level as the code it is a comment for; comments that are not correctly indented make the code less readable. For example: # go over the list of numbers given by the user for num in userNumList: # if it's odd, print it, if it's even, do nothing if num % 2 == 1: print(num) Built-In Functions and Functionality Python has many useful language features, built-in modules, and built-in functions that easily let a programmer perform a variety of tasks. However, due to the introductory nature of this course, you are not permitted to use any Python construct, built-in module, or third-party library that is not explicitly covered in the lecture slides. You are also not permitted to use anything that has not yet been covered in lecture. Using a built-in function or functionality to solve a problem by having Python do the work for you does not show that you have mastered the concepts behind it, and hence does not fulfill the assignment. If we do not show you how to use it in class, you can assume that it is off limits. If you find yourself unsure if you are allowed to use something, please consult with a member of the CMSC 201 course staff for clarification. Break and Continue Using break, pass, or continue is not allowed in any of your code for this class. Using these statements damages the readability of your code. Readability is a quality necessary for easy code maintenance. Using any of these will lead to an immediate deduction of points. Permitted Magicks An item becomes permitted when it is taught in the lecture. Before that, ask whether the item is permitted or forbidden. Any permitted item is subject to a ban for individual assignments. For instance, if a problem asks you to reverse a list, you will be forbidden from using anything that reverses a list, as you will be required to write a loop. · pass · for each · for i · while · if/elif/else · Lists · Append, remove · with (when used with files) · string methods, for example · String concatenation · ‘{}{}’ % (i, j) · ‘{}{}’.format(i, j) · Splicing · Dictionary Depends on Assignment · Reverse, reversed · Sort, sorted · Min, max, sum · Open · Ord, chr · round Forbidden Magicks The following list enumerates python features that we are not permitting in CMSC 201. The main reasons are: (1) they create bad habits (e.g. break and continue) (2) their use is way beyond the scope of the class (map, filter, class) (3) their use tends to result in hard to read and debug code (comprehensions) The general policy is that if something isn't covered in class or mentioned in the permitted section above, it is forbidden. · break · continue · lambda · map · class · filter · exit() · import · import is only permitted expressly on individual assignments · Tuples · multiple assignment · multiple returns · enumerate() · raise, try, except · isinstance() · assert · global, nonlocal · is · list and dict comprehensions, e.g. [a for a in [1, 2, 3]] Built-in Functions Python abs() returns absolute value of a number Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bin() converts integer to binary string Python bool() Converts a Value to Boolean Python bytearray() returns array of given byte size Python callable() Checks if the Object is Callable Python bytes() returns immutable bytes object Python chr() Returns a Character (a string) from an Integer Python compile() Returns a Python code object Python classmethod() returns class method for given function Python complex() Creates a Complex Number Python delattr() Deletes Attribute From the Object Python dict() Creates a Dictionary Python dir() Tries to Return Attributes of Object Python divmod() Returns a Tuple of Quotient and Remainder Python enumerate() Returns an Enumerate Object Python staticmethod() creates static method from a function Python filter() constructs iterator from elements which are true Python eval() Runs Python Code Within Program Python float() returns floating point number from number, string Python format() returns formatted representation of a value Python frozenset() returns immutable frozenset object Python getattr() returns value of named attribute of an object Python globals() returns dictionary of current global symbol table Python exec() Executes Dynamically Created Program Python hasattr() returns whether object has named attribute Python help() Invokes the built-in Help System Python hex() Converts to Integer to Hexadecimal Python hash() returns hash value of an object Python input() reads and returns a line of string Python id() Returns Identify of an Object Python isinstance() Checks if a Object is an Instance of Class Python int() returns integer from a number or string Python issubclass() Checks if a Object is Subclass of a Class Python iter() returns iterator for an object Python list() Function creates list in Python Python locals() Returns dictionary of a current local symbol table Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python next() Retrieves Next Element from Iterator Python memoryview() returns memory view of an argument Python object() Creates a Featureless Object Python oct() converts integer to octal Python ord() returns Unicode code point for Unicode character Python open() Returns a File object Python pow() returns x to the power of y Python print() Prints the Given Object Python property() returns a property attribute Python range() return sequence of integers between start and stop Python repr() returns printable representation of an object Python reversed() returns reversed iterator of a sequence Python round() rounds a floating point number to ndigits places. Python set() returns a Python set Python setattr() sets value of an attribute of object Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python str() returns informal representation of an object Python sum() Add items of an Iterable Python tuple() Function Creates a Tuple Python type() Returns Type of an Object Python vars() Returns __dict__ attribute of a class Python zip() Returns an Iterator of Tuples Python __import__() Advanced Function Called by import Python super() Allow you to Refer Parent Class by super Dictionary Methods Python Dictionary clear() Removes all Items Python Dictionary copy() Returns Shallow Copy of a Dictionary Python Dictionary fromkeys() creates dictionary from given sequence Python Dictionary get() Returns Value of The Key Python Dictionary items() returns view of dictionary's (key, value) pair Python Dictionary keys() Returns View Object of All Keys Python Dictionary popitem() Returns & Removes Element From Dictionary Python Dictionary setdefault() Inserts Key With a Value if Key is not Present Python Dictionary pop() removes and returns element having given key Python Dictionary values() returns view of all values in dictionary Python Dictionary update() Updates the Dictionary Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python dict() Creates a Dictionary Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python iter() returns iterator for an object Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples List Methods Python List append() Add Single Element to The List Python List extend() Add Elements of a List to Another List Python List insert() Inserts Element to The List Python List remove() Removes Element from the List Python List index() returns smallest index of element in list Python List count() returns occurrences of element in a list Python List pop() Removes Element at Given Index Python List reverse() Reverses a List Python List sort() sorts elements of a list Python List copy() Returns Shallow Copy of a List Python List clear() Removes all Items from the List Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python iter() returns iterator for an object Python list() Function creates list in Python Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python reversed() returns reversed iterator of a sequence Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples Set Methods Any use of sets in CMSC 201 is forbidden. String Methods Python String capitalize() Converts first character to Capital Letter Python String center() Pads string with specified character Python String casefold() converts to casefolded strings Python String count() returns occurrences of substring in string Python String endswith() Checks if String Ends with the Specified Suffix Python String expandtabs() Replaces Tab character With Spaces Python String encode() returns encoded string of given string Python String find() Returns the index of first occurrence of substring Python String format() formats string into nicer output Python String index() Returns Index of Substring Python String isalnum() Checks Alphanumeric Character Python String isalpha() Checks if All Characters are Alphabets Python String isdecimal() Checks Decimal Characters Python String isdigit() Checks Digit Characters Python String isidentifier() Checks for Valid Identifier Python String islower() Checks if all Alphabets in a String are Lowercase Python String isnumeric() Checks Numeric Characters Python String isprintable() Checks Printable Character Python String isspace() Checks Whitespace Characters Python String istitle() Checks for Titlecased String Python String isupper() returns if all characters are uppercase characters Python String join() Returns a Concatenated String Python String ljust() returns left-justified string of given width Python String rjust() returns right-justified string of given width Python String lower() returns lowercased string Python String upper() returns uppercased string Python String swapcase() swap uppercase characters to lowercase; vice versa Python String lstrip() Removes Leading Characters Python String rstrip() Removes Trailing Characters Python String strip() Removes Both Leading and Trailing Characters Python String partition() Returns a Tuple Python String maketrans() returns a translation table Python String rpartition() Returns a Tuple Python String translate() returns mapped charactered string Python String replace() Replaces Substring Inside Python String rfind() Returns the Highest Index of Substring Python String rindex() Returns Highest Index of Substring Python String split() Splits String from Left Python String rsplit() Splits String From Right Python String splitlines() Splits String at Line Boundaries Python String startswith() Checks if String Starts with the Specified String Python String title() Returns a Title Cased String Python String zfill() Returns a Copy of The String Padded With Zeros Python String format_map() Formats the String Using Dictionary Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python bytearray() returns array of given byte size Python bytes() returns immutable bytes object Python compile() Returns a Python code object Python complex() Creates a Complex Number Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python float() returns floating point number from number, string Python input() reads and returns a line of string Python int() returns integer from a number or string Python iter() returns iterator for an object Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python ord() returns Unicode code point for Unicode character Python reversed() returns reversed iterator of a sequence Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples Project 1 – Up the Hill and to ITE, A UMBC Trail Story Read this entire document before you begin! Due Date: Monday, April 6th, 2020 by 11:59:59 PM Value: 80 points """ File: FILENAME.py Author: YOUR NAME Date: THE DATE Section: YOUR DISCUSSION SECTION NUMBER E-mail: YOUR_EMAIL@umbc.edu Description: DESCRIPTION OF WHAT THE PROGRAM DOES """ Note: Game_map_1.txt has been changed, pycharm had replaced the tabs with spaces, so the tabs have been restored. Description Your task for this project is to write a UMBC trail program that mimics some functionality from Oregon Trail. This assignment will focus on using functions to break a large task down into smaller parts. A list of functions required for this project are found later in this document. You are required to follow the provided design exactly! You may add additional functions, but you must implement all of the specified functions as described in the design overview. At the end, your Project 1 file must run without any errors. It must also be called proj1.py (case sensitive). Outline of the Project This project involves four main phases. You will ask the user for two file names, a map file and an event file. The event file and map file contain data whose formats will be described later. 1. Read the map file, return the map data in some form to the rest of your program. 2. Read the event file, return the event data. 3. Build a character. 4. Play the game. The game will always start at "The Dorms" and end at "ITE" 5. If you make it to ITE before time expires, then you win. If your time remaining is zero and you are at ITE, then you win. However, if your time is -1, then you lose, even if you have reached ITE. 6. If time runs out, and you're not at ITE, you lose. Map file Format The map file will be formatted this way: [tab] is really just a tab, but I'm making it clear. There is not actually "[tab]" sitting in the files. Look at the files for more clarity. The Dorms [tab] The Commons, 40 [tab] The Pond, 60 The Pond [tab] ITE, 70 [tab] The UC, 45 The Commons [tab] Math Psych, 20 [tab] The UC, 30 Math Psych [tab] ITE, 10 The UC, 30 [tab] ITE, 5 ITE Each place will be named, and all of its destinations will be named with the time it takes to get there. The first one will always be The Dorms and the last one will be ITE with no destinations. More generically: starting_point [tab] destination_a, 10 [tab] destination_b, 20 [tab] destination_c, 30 Make sure to ignore any blank lines in the file. Each destination will have a comma and a time in seconds to reach it. There are no dead ends or backtracking, you will always reach ITE given infinite time. Event file Format The event format looks like this (with comma separators): [place name], [event text], [event win text], [event lose text], [charisma to bypass (int)], [stealth to bypass (int)], [time lost (int)] Here's an example: Engineering Building, A professor asks you about mod., 12 % 5 == 2, Mod confuses you and you are confused., 0, 4, 60 When you reach the engineering building, you'll display the text, if your character has enough charisma and stealth, then you can win, and display the winning text. Otherwise display the losing text and subtract the time loss from the player's time. Each location will have at most one event. Playing the Game You must start at "The Dorms" and you'll end at "ITE." Here are the phases of player turns: 1. Print some message about where you are and how long you have left to get to ITE. 2. Print out all the destinations from your current location, and the amount of time to get there. 3. Ask where you want to go, and make sure it's a valid location. 4. Subtract the time from the total. 5. If there's an event at that new location, process the event. 6. If your character's charisma is greater than or equal to the required charisma and your character's stealth is greater than or equal to the required stealth, then you bypass the obstruction, and there is no time penalty. 7. If one of your character's stats is not high enough, display the losing message and subtract the time penalty. 8. If the time has run out, or you're at the destination, end the game, otherwise go back to step one and go again. Creating the Character Enter a character name, a first and last name, or a first middle and last name. (Basically this means that the user should enter two or three "words.") Enter integer charisma and stealth. They must sum to 10 and both be non-negative. Coding Standards Prior to this assignment, you should re-read the Coding Standards, available on Blackboard under “Assignments” and linked on the course website at the top of the “Assignments” page. For now, you should pay special attention to the sections about: · Comments · Function header comments · Please note that the “Input” and “Output” in the function header comment do NOT mean what is shown on the screen with print(), or what is gotten from the user with input(). They refer to the parameters taken in, and the return value. (Both “Input” and/or “Output” may be None if appropriate.) · Constants · You must use constants instead of magic numbers or strings!!! · Make sure to read the last page of the Coding Standards document, which prohibits the use of certain tools and Python keywords. Additional Specifications For this assignment, you must follow the design overview in this document. For this assignment, you do need to worry about “input validation.” You may assume that the user will enter an integer, but it may be negative or outside of the allowable range. If the user enters a different type of data than what you asked for, your program may crash. This is acceptable. The same applies to files. A file will have the correct format with correct commas or tabs. The data in the files will also 'make sense' and a game can be played based on it. You don't need to check the game files for errors. Design Information Here are the definitions of four functions that you must use in your implementation of the project. The only global data that these functions are allowed to access are constants. That means, if the variable changes, you must pass it in as a parameter. def load_map(map_file_name): This function must take a string which is the file name, and return the "map" or some representation of it for the rest of the game to use. You can add arguments to the function, but you must pass the file name. This function must not set any global variables. def load_events(event_file_name): This function must take a string which is the file name, and return the events for the rest of the game to use. You can add arguments to the function, but you must pass the file name. This function must not set any global variables. def play_game(start_time, game_map, events): This function should handle most of the game functionality. Whatever is returned to you in load_map and load_events should go into this function, as well as the amount of time you have to play. You are allowed to change the arguments if you need more. However, you need to at least take in the data contained. This function must not set any global variables. def create_character(): This function should create your character by getting the name, charisma and stealthiness. This function should take no arguments. This function must not set any global variables.

Python Coding Standards Naming Conventions · Use meaningful variable names!! · For example, if your program needs a variable to represent the radius of a circle, call it radius, not r and not rad. · The use of obvious, common, meaningful abbreviations is permitted. For example, ‘number’ can be abbreviated as num as in num_students. · The use of single letter variables is forbidden except in loops. · Begin variable and function names with lowercase letters. · Names of constants should be in all caps with underscores between words. · e.g., EURO_TO_USD = 1.20 or MAX_NUM_STUDENTS = 100 · Separate “words” within identifiers (function names and variable names) with underscores eg., grand_total (Fun fact: this is called snake case because it makes the variables look kinda like snakes!) · Do not use global variables! Use of global variables is forbidden. Use of Whitespace The prudent use of whitespace goes a long way to making your program readable. Horizontal whitespace (spaces between characters) will make it easier to read your code. Vertical whitespace (blank lines between lines of code) will help you to organize it. · Use a single blank line to separate major parts of a function. · Use two blank lines to separate functions. · Indentation should be 4 spaces long. Using Tab in emacs will accomplish this. · Use spaces around all operators. · For example, write x = y + 5, NOT x=y+5. · Lines of code should be no longer than 79 characters (the default size of an emacs window). Code that “wraps” around a line is difficult to read. Line Length Avoid lines of code longer than 79 characters, since they’re not handled well by many terminals, and often make your code more difficult to read. If a line of your code is longer than 80 characters, you may be doing too much in one line of code, or you may have nested too deep with loops and conditionals. If you have a line of code that is unavoidably longer than 79 characters, you can continue the code on the next line by putting a “\” (backslash) after a breakpoint in the code (e.g., after a “+”, after a comma, etc.). If you’re using emacs, it will automatically indent the rest of the line of code following the backslash. For example: choice = int(input("Please enter a number between " + str(min n) + " and " + str(maxx) + ", inclusive: ")) Can become: choice = int(input("Please enter a number between " + \ str(minn) + " and " + str(maxx) + ", inclusive: ")) Sample Code """ File: lab2.py Author: YOUR NAME Date: THE DATE Lab Section: YOUR LAB Section Email: YOUREMAIL@umbc.edu Description: This program shows the layout of code in a Python file, and greets the user with the name of the programmer """ TOTALLY_NORMAL_HUMAN_NAME = "Yxcronor" def where_is_the_cat(cat, location_tried): """ A function to look for the cat :param cat: the name of the cat to look for :param location_tried: the integer IDs I'll look in :return: the integer ids for places I looked """ print("I don't know,", TOTALLY_NORMAL_HUMAN_NAME) return location_tried if __name__ == '__main__': # introduces the programmer print("Hello, my name is perfectly reasonable. \ Say, do you know where the cat is?") where_is_the_cat("Jules", [1, 2]) Use of Constants To improve readability, you should use constants whenever you are dealing with hard-coded values. Your code shouldn't have any “magic numbers,” or numbers whose meaning is unknown. Your code should also avoid “magic strings,” or strings that have a specific use within the program (e.g., choices a user could make such as “yes,” “STOP”, etc.). For example: total = subtotal + subtotal * .06 In the code above, .06 is a magic number. What is it? The number itself tells us nothing; at the very least, this code would require a comment. However, if we use a constant, the number's meaning becomes obvious, the code becomes more readable, and no comment is required. Constants are typically declared near the top of the program so that if their value ever changes they are easy to locate to modify. Constants may be placed before the if __name__ == "__main__": statement – this makes them global constants, which means everything in the file has access to them. (Global variables are only allowed for constants!) Here’s the updated code: TAX_RATE = .06 if __name__ == '__main__': # lots of code goes here total = subtotal + subtotal * TAX_RATE # other code goes here print("Maryland has a sales tax rate of", TAX_RATE, "percent") Comments Programmers rely on comments to help document the project and parts of the project. Generally, we categorize comments as one of three types: 1. File Header Comments 2. Function Header Comments 3. In-Line Comments (1) and (2) will use triple quotes (""") A.K.A. docstrings. (3) will use pound signs (#). 1. File Header Comments Every file should contain a comment at the top describing the contents of the file and other pertinent information. This "file header comment" MUST include the following information. · The file name · Your name · The date the file was created · Your section number · Your UMBC e-mail address · A brief description of the contents of the file For example: """ File: lab2.py Author: YOUR NAME Date: THE DATE Lab Section: YOUR LAB Section Email: YOUREMAIL@umbc.edu Description: This program shows the layout of code in a Python file, and greets the user with the name of the programmer """ 2. Function Header Comments Every single function must have a header comment that includes the following: · A description of what the function does · :param parameter_name (name, type and short description) · :return: description of what is returned For example: def where_is_the_cat(cat, location_tried): """ A function to look for the cat :param cat: the name of the cat to look for :param location_tried: the integer IDs I'll look in :return: the integer ids for places I looked """ print("I don't know,", TOTALLY_NORMAL_HUMAN_NAME) return location_tried 3. In-Line Comments In-line comments are comments within the code itself. They are normally comments for the line(s) of code directly below them. Well-structured code will be broken into logical sections that perform a simple task. Each of these sections of code (often starting with an 'if' statement, or a loop) should be documented. · Any “confusing looking” code should also be commented. · Do not comment every line of code. Trivial comments (e.g., # increment x ) clutter up your code and are worse than no comments at all. · In-line comments are used to clarify what your code does, not how it does it. An in-line comment appears above the code to which it applies. It is also indented to the same level as the code it is a comment for; comments that are not correctly indented make the code less readable. For example: # go over the list of numbers given by the user for num in userNumList: # if it's odd, print it, if it's even, do nothing if num % 2 == 1: print(num) Built-In Functions and Functionality Python has many useful language features, built-in modules, and built-in functions that easily let a programmer perform a variety of tasks. However, due to the introductory nature of this course, you are not permitted to use any Python construct, built-in module, or third-party library that is not explicitly covered in the lecture slides. You are also not permitted to use anything that has not yet been covered in lecture. Using a built-in function or functionality to solve a problem by having Python do the work for you does not show that you have mastered the concepts behind it, and hence does not fulfill the assignment. If we do not show you how to use it in class, you can assume that it is off limits. If you find yourself unsure if you are allowed to use something, please consult with a member of the CMSC 201 course staff for clarification. Break and Continue Using break, pass, or continue is not allowed in any of your code for this class. Using these statements damages the readability of your code. Readability is a quality necessary for easy code maintenance. Using any of these will lead to an immediate deduction of points. Permitted Magicks An item becomes permitted when it is taught in the lecture. Before that, ask whether the item is permitted or forbidden. Any permitted item is subject to a ban for individual assignments. For instance, if a problem asks you to reverse a list, you will be forbidden from using anything that reverses a list, as you will be required to write a loop. · pass · for each · for i · while · if/elif/else · Lists · Append, remove · with (when used with files) · string methods, for example · String concatenation · ‘{}{}’ % (i, j) · ‘{}{}’.format(i, j) · Splicing · Dictionary Depends on Assignment · Reverse, reversed · Sort, sorted · Min, max, sum · Open · Ord, chr · round Forbidden Magicks The following list enumerates python features that we are not permitting in CMSC 201. The main reasons are: (1) they create bad habits (e.g. break and continue) (2) their use is way beyond the scope of the class (map, filter, class) (3) their use tends to result in hard to read and debug code (comprehensions) The general policy is that if something isn't covered in class or mentioned in the permitted section above, it is forbidden. · break · continue · lambda · map · class · filter · exit() · import · import is only permitted expressly on individual assignments · Tuples · multiple assignment · multiple returns · enumerate() · raise, try, except · isinstance() · assert · global, nonlocal · is · list and dict comprehensions, e.g. [a for a in [1, 2, 3]] Built-in Functions Python abs() returns absolute value of a number Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bin() converts integer to binary string Python bool() Converts a Value to Boolean Python bytearray() returns array of given byte size Python callable() Checks if the Object is Callable Python bytes() returns immutable bytes object Python chr() Returns a Character (a string) from an Integer Python compile() Returns a Python code object Python classmethod() returns class method for given function Python complex() Creates a Complex Number Python delattr() Deletes Attribute From the Object Python dict() Creates a Dictionary Python dir() Tries to Return Attributes of Object Python divmod() Returns a Tuple of Quotient and Remainder Python enumerate() Returns an Enumerate Object Python staticmethod() creates static method from a function Python filter() constructs iterator from elements which are true Python eval() Runs Python Code Within Program Python float() returns floating point number from number, string Python format() returns formatted representation of a value Python frozenset() returns immutable frozenset object Python getattr() returns value of named attribute of an object Python globals() returns dictionary of current global symbol table Python exec() Executes Dynamically Created Program Python hasattr() returns whether object has named attribute Python help() Invokes the built-in Help System Python hex() Converts to Integer to Hexadecimal Python hash() returns hash value of an object Python input() reads and returns a line of string Python id() Returns Identify of an Object Python isinstance() Checks if a Object is an Instance of Class Python int() returns integer from a number or string Python issubclass() Checks if a Object is Subclass of a Class Python iter() returns iterator for an object Python list() Function creates list in Python Python locals() Returns dictionary of a current local symbol table Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python next() Retrieves Next Element from Iterator Python memoryview() returns memory view of an argument Python object() Creates a Featureless Object Python oct() converts integer to octal Python ord() returns Unicode code point for Unicode character Python open() Returns a File object Python pow() returns x to the power of y Python print() Prints the Given Object Python property() returns a property attribute Python range() return sequence of integers between start and stop Python repr() returns printable representation of an object Python reversed() returns reversed iterator of a sequence Python round() rounds a floating point number to ndigits places. Python set() returns a Python set Python setattr() sets value of an attribute of object Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python str() returns informal representation of an object Python sum() Add items of an Iterable Python tuple() Function Creates a Tuple Python type() Returns Type of an Object Python vars() Returns __dict__ attribute of a class Python zip() Returns an Iterator of Tuples Python __import__() Advanced Function Called by import Python super() Allow you to Refer Parent Class by super Dictionary Methods Python Dictionary clear() Removes all Items Python Dictionary copy() Returns Shallow Copy of a Dictionary Python Dictionary fromkeys() creates dictionary from given sequence Python Dictionary get() Returns Value of The Key Python Dictionary items() returns view of dictionary's (key, value) pair Python Dictionary keys() Returns View Object of All Keys Python Dictionary popitem() Returns & Removes Element From Dictionary Python Dictionary setdefault() Inserts Key With a Value if Key is not Present Python Dictionary pop() removes and returns element having given key Python Dictionary values() returns view of all values in dictionary Python Dictionary update() Updates the Dictionary Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python dict() Creates a Dictionary Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python iter() returns iterator for an object Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples List Methods Python List append() Add Single Element to The List Python List extend() Add Elements of a List to Another List Python List insert() Inserts Element to The List Python List remove() Removes Element from the List Python List index() returns smallest index of element in list Python List count() returns occurrences of element in a list Python List pop() Removes Element at Given Index Python List reverse() Reverses a List Python List sort() sorts elements of a list Python List copy() Returns Shallow Copy of a List Python List clear() Removes all Items from the List Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python iter() returns iterator for an object Python list() Function creates list in Python Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python reversed() returns reversed iterator of a sequence Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples Set Methods Any use of sets in CMSC 201 is forbidden. String Methods Python String capitalize() Converts first character to Capital Letter Python String center() Pads string with specified character Python String casefold() converts to casefolded strings Python String count() returns occurrences of substring in string Python String endswith() Checks if String Ends with the Specified Suffix Python String expandtabs() Replaces Tab character With Spaces Python String encode() returns encoded string of given string Python String find() Returns the index of first occurrence of substring Python String format() formats string into nicer output Python String index() Returns Index of Substring Python String isalnum() Checks Alphanumeric Character Python String isalpha() Checks if All Characters are Alphabets Python String isdecimal() Checks Decimal Characters Python String isdigit() Checks Digit Characters Python String isidentifier() Checks for Valid Identifier Python String islower() Checks if all Alphabets in a String are Lowercase Python String isnumeric() Checks Numeric Characters Python String isprintable() Checks Printable Character Python String isspace() Checks Whitespace Characters Python String istitle() Checks for Titlecased String Python String isupper() returns if all characters are uppercase characters Python String join() Returns a Concatenated String Python String ljust() returns left-justified string of given width Python String rjust() returns right-justified string of given width Python String lower() returns lowercased string Python String upper() returns uppercased string Python String swapcase() swap uppercase characters to lowercase; vice versa Python String lstrip() Removes Leading Characters Python String rstrip() Removes Trailing Characters Python String strip() Removes Both Leading and Trailing Characters Python String partition() Returns a Tuple Python String maketrans() returns a translation table Python String rpartition() Returns a Tuple Python String translate() returns mapped charactered string Python String replace() Replaces Substring Inside Python String rfind() Returns the Highest Index of Substring Python String rindex() Returns Highest Index of Substring Python String split() Splits String from Left Python String rsplit() Splits String From Right Python String splitlines() Splits String at Line Boundaries Python String startswith() Checks if String Starts with the Specified String Python String title() Returns a Title Cased String Python String zfill() Returns a Copy of The String Padded With Zeros Python String format_map() Formats the String Using Dictionary Python any() Checks if any Element of an Iterable is True Python all() returns true when all elements in iterable is true Python ascii() Returns String Containing Printable Representation Python bool() Converts a Value to Boolean Python bytearray() returns array of given byte size Python bytes() returns immutable bytes object Python compile() Returns a Python code object Python complex() Creates a Complex Number Python enumerate() Returns an Enumerate Object Python filter() constructs iterator from elements which are true Python float() returns floating point number from number, string Python input() reads and returns a line of string Python int() returns integer from a number or string Python iter() returns iterator for an object Python len() Returns Length of an Object Python max() returns largest element Python min() returns smallest element Python map() Applies Function and Returns a List Python ord() returns Unicode code point for Unicode character Python reversed() returns reversed iterator of a sequence Python slice() creates a slice object specified by range() Python sorted() returns sorted list from a given iterable Python sum() Add items of an Iterable Python zip() Returns an Iterator of Tuples Project 1 – Up the Hill and to ITE, A UMBC Trail Story Read this entire document before you begin! Due Date: Monday, April 6th, 2020 by 11:59:59 PM Value: 80 points """ File: FILENAME.py Author: YOUR NAME Date: THE DATE Section: YOUR DISCUSSION SECTION NUMBER E-mail: YOUR_EMAIL@umbc.edu Description: DESCRIPTION OF WHAT THE PROGRAM DOES """ Note: Game_map_1.txt has been changed, pycharm had replaced the tabs with spaces, so the tabs have been restored. Description Your task for this project is to write a UMBC trail program that mimics some functionality from Oregon Trail. This assignment will focus on using functions to break a large task down into smaller parts. A list of functions required for this project are found later in this document. You are required to follow the provided design exactly! You may add additional functions, but you must implement all of the specified functions as described in the design overview. At the end, your Project 1 file must run without any errors. It must also be called proj1.py (case sensitive). Outline of the Project This project involves four main phases. You will ask the user for two file names, a map file and an event file. The event file and map file contain data whose formats will be described later. 1. Read the map file, return the map data in some form to the rest of your program. 2. Read the event file, return the event data. 3. Build a character. 4. Play the game. The game will always start at "The Dorms" and end at "ITE" 5. If you make it to ITE before time expires, then you win. If your time remaining is zero and you are at ITE, then you win. However, if your time is -1, then you lose, even if you have reached ITE. 6. If time runs out, and you're not at ITE, you lose. Map file Format The map file will be formatted this way: [tab] is really just a tab, but I'm making it clear. There is not actually "[tab]" sitting in the files. Look at the files for more clarity. The Dorms [tab] The Commons, 40 [tab] The Pond, 60 The Pond [tab] ITE, 70 [tab] The UC, 45 The Commons [tab] Math Psych, 20 [tab] The UC, 30 Math Psych [tab] ITE, 10 The UC, 30 [tab] ITE, 5 ITE Each place will be named, and all of its destinations will be named with the time it takes to get there. The first one will always be The Dorms and the last one will be ITE with no destinations. More generically: starting_point [tab] destination_a, 10 [tab] destination_b, 20 [tab] destination_c, 30 Make sure to ignore any blank lines in the file. Each destination will have a comma and a time in seconds to reach it. There are no dead ends or backtracking, you will always reach ITE given infinite time. Event file Format The event format looks like this (with comma separators): [place name], [event text], [event win text], [event lose text], [charisma to bypass (int)], [stealth to bypass (int)], [time lost (int)] Here's an example: Engineering Building, A professor asks you about mod., 12 % 5 == 2, Mod confuses you and you are confused., 0, 4, 60 When you reach the engineering building, you'll display the text, if your character has enough charisma and stealth, then you can win, and display the winning text. Otherwise display the losing text and subtract the time loss from the player's time. Each location will have at most one event. Playing the Game You must start at "The Dorms" and you'll end at "ITE." Here are the phases of player turns: 1. Print some message about where you are and how long you have left to get to ITE. 2. Print out all the destinations from your current location, and the amount of time to get there. 3. Ask where you want to go, and make sure it's a valid location. 4. Subtract the time from the total. 5. If there's an event at that new location, process the event. 6. If your character's charisma is greater than or equal to the required charisma and your character's stealth is greater than or equal to the required stealth, then you bypass the obstruction, and there is no time penalty. 7. If one of your character's stats is not high enough, display the losing message and subtract the time penalty. 8. If the time has run out, or you're at the destination, end the game, otherwise go back to step one and go again. Creating the Character Enter a character name, a first and last name, or a first middle and last name. (Basically this means that the user should enter two or three "words.") Enter integer charisma and stealth. They must sum to 10 and both be non-negative. Coding Standards Prior to this assignment, you should re-read the Coding Standards, available on Blackboard under “Assignments” and linked on the course website at the top of the “Assignments” page. For now, you should pay special attention to the sections about: · Comments · Function header comments · Please note that the “Input” and “Output” in the function header comment do NOT mean what is shown on the screen with print(), or what is gotten from the user with input(). They refer to the parameters taken in, and the return value. (Both “Input” and/or “Output” may be None if appropriate.) · Constants · You must use constants instead of magic numbers or strings!!! · Make sure to read the last page of the Coding Standards document, which prohibits the use of certain tools and Python keywords. Additional Specifications For this assignment, you must follow the design overview in this document. For this assignment, you do need to worry about “input validation.” You may assume that the user will enter an integer, but it may be negative or outside of the allowable range. If the user enters a different type of data than what you asked for, your program may crash. This is acceptable. The same applies to files. A file will have the correct format with correct commas or tabs. The data in the files will also 'make sense' and a game can be played based on it. You don't need to check the game files for errors. Design Information Here are the definitions of four functions that you must use in your implementation of the project. The only global data that these functions are allowed to access are constants. That means, if the variable changes, you must pass it in as a parameter. def load_map(map_file_name): This function must take a string which is the file name, and return the "map" or some representation of it for the rest of the game to use. You can add arguments to the function, but you must pass the file name. This function must not set any global variables. def load_events(event_file_name): This function must take a string which is the file name, and return the events for the rest of the game to use. You can add arguments to the function, but you must pass the file name. This function must not set any global variables. def play_game(start_time, game_map, events): This function should handle most of the game functionality. Whatever is returned to you in load_map and load_events should go into this function, as well as the amount of time you have to play. You are allowed to change the arguments if you need more. However, you need to at least take in the data contained. This function must not set any global variables. def create_character(): This function should create your character by getting the name, charisma and stealthiness. This function should take no arguments. This function must not set any global variables.

Related Questions

Similar orders to I need to have my programming project completed quick.
43
Views
0
Answers
PG2 – LAB 2: BLACKJACK OBJECTS
CONTENTS Overview........................................................................................................................................................................2 Part A - Classes......................................................
24
Views
0
Answers
Excel Project with Documentation
In a new sheet, create one-variable data tables for these food items. For each previously selected food item, create a two-variable data table that calculates the amounts of calories based on various portion sizes and the number of portions. I have att...
52
Views
0
Answers
Computer Vision - (Machine Learning, Artificial Intelligence field) assignment in python
Video processing, image processing, object detection, object tracking, background removel. It needs to be in PYTHON. Objective The goal of this project is to develop an automatic system for video analysis of footages for the game of curling. The system...
19
Views
0
Answers
Writing and understanding simple java program code
I need help writing a java program with an Eclipse IDE. Once written I need to identify, objects, lists, algorithms, set of instructions, anything that explains how the code is written, what it does, and how an end user will use it...