Question: The programing language is PYTHON 3 Hello, please i need help with this. These are the instructions This project involves four main phases. You will
The programing language is PYTHON 3
Hello, please i need help with this. These are the instructions
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.
- Read the map file, return the map data in some form to the rest of my program.
- Read the event file, return the event data.
- Build a character.
- Play the game. The game will always start at "The Dorms" and end at "ITE"
- If you make it to ITE before time expires, then you win. If the time remaining is zero and you are at ITE, then you win. However, if the time is -1, then you lose, even if you have reached ITE.
- 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 the 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.
[More sample maps and events may be added here, stay tuned.]
Playing the Game
You must start at "The Dorms" and you'll end at "ITE."
Here are the phases of player turns:
- Print some message about where you are and how long you have left to get to ITE.
- Print out all the destinations from the current location, and the amount of time to get there.
- Ask where you want to go, and make sure it's a valid location.
- Subtract the time from the total.
- If there's an event at that new location, process the event.
- If the character's charisma is greater than or equal to the required charisma and the character's stealth is greater than or equal to the required stealth, then you bypass the obstruction, and there is no time penalty.
- If one of the character's stats is not high enough, display the losing message and subtract the time penalty.
- 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, I must follow the design overview in this document.
For this assignment, I 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, the 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. Point Value of the Project
- Use dictionaries!!!!!
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 make your character by getting the name, charisma and stealthiness. This function should take no arguments. This function must not set any global variables.
It is due today so I would very much appreciate the help as soon as possible.
Project 1 (sp20) Sample Output.docx
A Losing Game:
linux1[4]% python3 proj1.py
What is the map file? game_map_1.txt
What is the events file? game_events_1.txt
How much time do you want to start with? 300
What is your name? Enter a first (middle) last separated
by spaces, middle being optional. E H
You have 10 skill points to distribute, otherwise you
aren't going anywhere.
How charismatic are you, you have 10 skill points left? 5
How sneaky are you, you have 5 skill points left? 5
You are currently in The Dorms and have 300 seconds left
to get to ITE.
Public Policy 50
Physics Building 100
The Commons 120
Where do you want to go next?Physics Building
You are currently in Physics Building and have 200 seconds
left to get to ITE.
The Commons 30
The Quad 70
Where do you want to go next?The Quad
You are currently in The Quad and have 130 seconds left to
get to ITE.
Biology Building 35
Math Psych Building 50
Where do you want to go next?Biology Building
A concerted squirrel attack is being organized. They're
not gathering nuts anymore... they're in the trashcans
waiting to jump out and get you.
You sneak past them!
You are currently in Biology Building and have 95 seconds
left to get to ITE.
Math Psych Building 75
University Center 125
Where do you want to go next?Math Psych Building
A friend stops you in the hall way.
They trap you in conversation about the latest and
dankest memes.
You are currently in Math Psych Building and have 20 seconds left to get to ITE.
The Stairs by Sherman 50
University Center 35
Where do you want to go next?University Center
LaRouche Supporters have congregated.
You dispel their petty notions and leave quickly.
You have run out of time, and so you lose.
linux1[5]% A Winning Game:
linux1[5]% python3 proj1.py
What is the map file? game_map_1.txt
What is the events file? game_events_1.txt
How much time do you want to start with? 1000
What is your name? Enter a first (middle) last separated
by spaces, middle being optional. Caesar Augustus
You have 10 skill points to distribute, otherwise you
aren't going anywhere.
How charismatic are you, you have 10 skill points left? -2
How sneaky are you, you have 12 skill points left? 17
You have 10 skill points to distribute, they must all be
positive.
How charismatic are you, you have 10 skill points left? 4
How sneaky are you, you have 6 skill points left? 4
You have 10 skill points to distribute, they must all be
positive.
How charismatic are you, you have 10 skill points left? 2
How sneaky are you, you have 8 skill points left? 8
You are currently in The Dorms and have 1000 seconds left
to get to ITE.
Public Policy 50
Physics Building 100
The Commons 120
Where do you want to go next?The Commons
A sorority selling donuts
You get cornered and buy 10 boxes.
You lose 30 seconds.
You are currently in The Commons and have 850 seconds left
to get to ITE.
The Quad 15 Biology Building 20
Where do you want to go next?Biology Building
A concerted squirrel attack is being organized. They're
not gathering nuts anymore... they're in the trashcans
waiting to jump out and get you.
You sneak past them!
You are currently in Biology Building and have 830 seconds
left to get to ITE.
Math Psych Building 75
University Center 125
Where do you want to go next?University Center
LaRouche Supporters have congregated.
You are trapped in a never ending discussion.
You lose 200 seconds.
You are currently in University Center and have 505
seconds left to get to ITE.
Engineering Building 75
The Stairs by Sherman 25
Where do you want to go next?The Stairs by Sherman
A large crowd of students stampede in the wrong direction.
You move through them very sneakily.
You are currently in The Stairs by Sherman and have 480
seconds left to get to ITE.
ITE 50
Where do you want to go next?ITE
You made it to ITE and now can learn the secrets of
computer science. You win!
linux1[6]% Another Game:
linux1[6]% python3 proj1.py
What is the map file? game_map_1.txt
What is the events file? game_events_1.txt
How much time do you want to start with? 500
What is your name? Enter a first (middle) last separated
by spaces, middle being optional. Me
What is your name? Enter a first (middle) last separated
by spaces, middle being optional. The Greatest Human
You have 10 skill points to distribute, otherwise you
aren't going anywhere.
How charismatic are you, you have 10 skill points left? 5
How sneaky are you, you have 5 skill points left? 5
You are currently in The Dorms and have 500 seconds left
to get to ITE.
Public Policy 50
Physics Building 100
The Commons 120
Where do you want to go next?Physics Building
You are currently in Physics Building and have 400 seconds
left to get to ITE.
The Commons 30
The Quad 70
Where do you want to go next?The Commons
A sorority selling donuts
You charm them with your witty banter and run away.
You are currently in The Commons and have 370 seconds left
to get to ITE.
The Quad 15
Biology Building 20
Where do you want to go next?Biology Building
A concerted squirrel attack is being organized. They're
not gathering nuts anymore... they're in the trashcans
waiting to jump out and get you.
You sneak past them!
You are currently in Biology Building and have 350 seconds
left to get to ITE.
Math Psych Building 75
University Center 125
Where do you want to go next?Math Psych Building A friend stops you in the hall way.
They trap you in conversation about the latest and
dankest memes.
You are currently in Math Psych Building and have 275
seconds left to get to ITE.
The Stairs by Sherman 50
University Center 35
Where do you want to go next?University Center
LaRouche Supporters have congregated.
You dispel their petty notions and leave quickly.
You are currently in University Center and have 240
seconds left to get to ITE.
Engineering Building 75
The Stairs by Sherman 25
Where do you want to go next?Engineering Building
A professor asks you about mod.
12 % 5 == 2
You are currently in Engineering Building and have 165
seconds left to get to ITE.
ITE 30
Where do you want to go next?ITE
You made it to ITE and now can learn the secrets of
computer science. You win!
linux1[7]%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
