Question
PLEASE READ THIS PART: This is a pretty extensive program and I've got it mostly figured out, the only thing I can't figure out is
PLEASE READ THIS PART:
This is a pretty extensive program and I've got it mostly figured out, the only thing I can't figure out is how to calculate the formula for how to move cat or snake towards the bird...I have the closest bird targeted, and the bird's position is in the range -100 to + 100 in X and Y and between 0 and 10 in Z. The predator's position is the same -100 and 100 for x and y, but Z is always = 0.
for instance... cat.pos.X = 9; cat.pos.Y = -7; cat.pos.Z = 0;
bird.pos.X = 57; bird.pos.Y = -68; bird.pos.Z = 6 I have a method that will move the cat with cat.move(X, Y,Z)...I just don't know the formula to figure out how to move it towards the bird (noting that cats can move 16 and snakes can move 14).
Program is in C#! Thanks!!
(Basically I just need the solution for number 2 in the following)
Your main program should have a while loop with the following procedure:
1. Each iteration over the animals list the Cat or Snake will eat Birds that are in range (They should print off that they are eating something). Cats have a range of 8, snakes have a range of 3. 2. If there is nothing in range to eat, the animal move towards the nearest bird. Cats move at a speed of 16 (i.e., the position will be changed by 16), snakes at a speed of 14. 3. Then birds that survive will randomly move as per their rules above. 4. This loop repeats until all birds have been eaten. 5. After every fifth iteration, PrintallForward 6. Report how many rounds it took.
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