Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part V: Vampire Hunters (20 points) An intrepid band of vampire hunters has just arrived at a town where a coven of vampires is preying

image text in transcribed
image text in transcribed
Part V: Vampire Hunters (20 points) An intrepid band of vampire hunters has just arrived at a town where a coven of vampires is preying on the townspeople. Your job is to write a function vampire.hunt (humans, vampires, hunters) that will simulate how the populations of townspeople and vampires will change over time as the vampire hunters set to work The town is populated by humans people, is threatened by vampires scary vampires, and is protected by hunters vampire hunters. Each vampire can convert one person a day into a new vampire. (Luckily, the vampire hunters are all immune to vampire bites.) Each vampire hunter can destroy one vampire per day. Since we don't know how many days it might take to reduce one of the populations to O (i.e, humans or vampires) we cant use a for-loop to simulate the fight. Instead, we will use a while-loop, which will run until one of the two CSE 101-Spring 2018 Homework #3 Page 5 populations reaches 0 The bulk of your program will take place in a while-loop. As long as each population (humans and vampires) is greater than 0, your program should: 1. Determine how many vampires are destroyed that day (the vampire hunters always strike first, during day- light hours), and update the vampire population appropriately. This counter may reach 0, but it must never be allowed to become negative. 2. If there are any vampires remaining, they attack the remaining townspeople that night. Each vampire converts one person into a new vampire. Update the vampire population and human population accordingly Like the previous step, the human population can reach 0, but it should never become negative. Sample Simulation #1 Starting values: humans -84vampires6, hunters2. Day 1: Humans: 84 Vampires: 6. Hunters dest royed 2 vampires. Vampires converted 4 people into vampires. Day #2: Humans: 80 Vampires: 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago