Suppose there are 4 cars A, B, C, and D. D is chased by C, C is chased by B, B is chased by
Suppose there are 4 cars A, B, C, and D. D is chased by C, C is chased by B, B is chased by A. D is moving independently parallel to y-axis. Initial positions of A, B, C, and D are (10,0), (0,10), (10,10) and (0,0). Velocities of A, B, C and D are 3, 5, 7 and 2 ms. Now simulate this chase problem for t=20 unit time. Print the x and y coordinate value of each vehicle at every time step. If The distance between any 2 vehicles is less than 5 m then a car will shoot its target [not destroy]. Print all the shootings and finally print the number of times each car got shot during the simulation. Also draw the graph showing the path of each car. Use plt.plot() function to do this.
Step by Step Solution
3.40 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
To simulate this chase problem and calculate the positions shootings and number of times each car go...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