computer science. i need help with writing a code in python3.

profileoiqmaf50j
python3.ola5_.pdf

Open Lab Five Due Date: 11 November 2015, 9: 00am Calculating video game battle events Write a complete Python program, including appropriate

comments, that calculates how many hits it takes for our

hero to defeat various enemies.

Damage points inflicted by our hero are calculated with

the following formula:

𝑫𝒂𝒎𝒂𝒈𝒆 𝑷𝒐𝒊𝒏𝒕𝒔 = 𝑯𝒆𝒓𝒐 𝑺𝒕𝒓𝒆𝒏𝒈𝒕𝒉 − 𝑬𝒏𝒆𝒎𝒚 𝑨𝒈𝒊𝒍𝒊𝒕𝒚𝟐

𝑫𝒂𝒎𝒂𝒈𝒆 𝑴𝒐𝒅𝒊𝒇𝒊𝒆𝒓

For this program, the value of Damage Modifier can be 2, 3, or 4. This value should be chosen randomly

by the program each time damage is calculated.

If the calculated value of Damage Points is less than 1, then there is 50/50 chance that the hero will do

either no damage or 1 damage.

Your program must include the following three functions:

x calc_damage(hero_strength, enemy_agility) This function returns how many damage points one hit will inflict.

x calc_hits(hero_strength, enemy_agility, enemy_hp) This function returns how many hits required to defeat an enemy.

x main() The main program function

Program Input:

Two input files will be used, hero_stats.txt and enemy_stats.txt. They have the following format:

enemy_stats.txt #00 : Slime Strength: 5 Agility: 3 Hit Points: 3 #01 : Red Slime 7 3 4 #02 : Drakee 9 6 5 ... ... hero_stats.txt Level 1 Stats Hit Points: 15 Magic Points: 6 Strength: 8 Agility: 6 Resilience: 7 Wisdom: 6 Luck: 5

Use the following commands to copy these input files directly to your Ranger account:

cp ~lb3s/public_html/1170/enemy_stats.txt . cp ~lb3s/public_html/1170/hero_stats_1.txt . cp ~lb3s/public_html/1170/hero_stats_2.txt . cp ~lb3s/public_html/1170/hero_stats_3.txt .

Program Output:

Your program should store results in a text file named battle_results.txt. Use the following format:

battle_results.txt Enemy Info: #00 : Slime Hits to defeat: 1 #01 : Red Slime 1 ... #32 : Wizard 5

. . .

A script file containing sample output is available online. Since random numbers are involved, it is

possible slight variations may arise each time your program is executed.

Requirements:

1. Your program must run on Ranger. You are welcome to program in the environment in which you are comfortable, but I will grade all assignments on Ranger with the currently installed

Python3 interpreter.

2. Your program should use the following opening comment block: # filename: yourProgramFile.py # course: 1170-002 # author: your first and last name # program purpose: brief description of what the program does

You should also have comments throughout your code explaining the purpose of each

function, each variable, and the main steps of the program.

3. When you have finished your program and corrected any possible errors, you will submit an electronic copy of your source code using the turnin command. This command will look like this:

turnin lb3s ola5 yourProgramFile.py

The usage for turnin is: turnin instructor assignment programfile. For more information on

using turnin, please visit http://cs.mtsu.edu/~lb3s/1170/turnin_notes.html

4. After you have submitted your assignment with the turnin command, prepare a log file i. Close all IDLE windows.

ii. In the Terminal window, type the following commands, pressing enter after each command:

script yourlastname5ola.log pwd cat –n yourProgramFile.py python3 yourProgramFile.py exit

iii. Print your log file by typing the following command in the Terminal window:

lph yourlastname5ola.log This command sends your file to the printer in KOM 360. (If you are doing this

lab outside of KOM 360, it still prints to KOM 360!)

iv. Write the following information on your printout:

Your name 1170-002 Open Lab 5 Date: mm/dd/yyyy

v. Place your printout and your completed rubric in a folder and turn in during the next scheduled class period.

Sources:

Image: https://upload.wikimedia.org/wikipedia/en/7/70/Dragon_quest_battle_2.png

Formulas and enemy stats: http://www.gamefaqs.com/nes/563408-dragon-warrior/faqs/61640

Hero stats: http://dragon-quest.org/wiki/Erdrick#Base_Stats