Question
In one battle area, you are provided with a list of monsters to go along with your D&D game. You decide to create a program
In one battle area, you are provided with a list of monsters to go along with your D&D game. You decide to create a program to read this information and process store additional information about these monsters.
The input Monsters.csv is also attached in this assignment. Write a script that reads this CSV file into Python and, for each monster in the list, adds the following columns for output
-Level
-Damage
-Hit points
For Level, the following guidelines apply
-Gnomes are level 1
-Orcs are level 2
-Skeletons are level 5
-Giants are level 8
For Damage, the following apply
-Gnomes can damage 1-3 hit points at random
-Orcs can damage 2-7 hit points at random
-Skeletons can damage 3-12 hit points at random
-Giants can damage 4-24 hit points at random
For Hit points, the following apply
-Gnomes can have 3-6 hit points at random
-Orcs can have 4-8 hit points at random
-Skeletons can have 6-12 hit points at random
-Giants can have 12-20 hit points at random
The code should output to a file called New-Monsters.csv, which follows the guidelines from above, and will provide spreadsheet information (random where appropriate) like the following (attached in New-Monsters-SAMPLE.csv):
Monster Name,Level,Damage,Hit points
Gnome,1,1,3
Gnome,1,3,4
Gnome,1,3,6
Gnome,1,1,4
Gnome,1,2,3
Orc,2,4,8
Orc,2,6,7
Orc,2,2,8
Skeleton,5,12,6
Skeleton,5,4,9
Orc,8,19,16
Hints:
-The Header (first) row from the input doesnt require calculations, but are part of the output csv file, so make sure its added back in the output csv file
-In order to randomly generate an integer between two numbers, use the randint(x,y) function from the random library, e.g.:
Requirements:
Write the program as described above in the Python py-file format. No need to create a:
Write the program as described above in the Python py-file format. No need to create a user function if you do not want to.
Your program should be able to handle varying numbers of Gnomes, Orcs, Skeletons, Giants from input. In other words, if the number of Monsters in Monsters.csv changes (e.g. another Gnome is added, or an Orc is removed, etc), your program should handle that.
Monster Name | Level | Damage | Hit points |
Gnome | 1 | 1 | 3 |
Gnome | 1 | 3 | 4 |
Gnome | 1 | 3 | 6 |
Gnome | 1 | 1 | 4 |
Gnome | 1 | 2 | 3 |
Orc | 2 | 4 | 8 |
Orc | 2 | 6 | 7 |
Orc | 2 | 2 | 8 |
Skeleton | 5 | 12 | 6 |
Skeleton | 5 | 4 | 9 |
Giant | 8 | 19 | 16 |
The numbers must be generated randomly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started