Question: this is in python! please help. its one question its just long. thank you A group of turtles numbered 0 through 23 (inclusive) are hanging

this is in python! please help. its one question its just long. thank you  this is in python! please help. its one question its just
long. thank you A group of turtles numbered 0 through 23 (inclusive)

A group of turtles numbered 0 through 23 (inclusive) are hanging out in the pond near the Japanese garden by University Drive. A cold wind passes by. Turtles 0 and 23 , by chance, are huddled in two positions (0,0) and (1,1) which are sheltered from the wind, and will not move. The rest, though, instinctively seek out their friends to huddle for warmth 1. Each turtle is friends with its two number-neighbors; for instance, Turtle 1 is friends with Turtle 0 (who isn't moving no matter what) and Turtle 2. Turtle 2 is friends with 1 and 3 . And so on. The turtles have no collective coordination - so each will only take note of where its two friends are, and move in their general direction (the average of their positions). For instance, suppose Turtle 4 seeks its friends 3 and 5 . It sees them at (2,0) and (1,2). Then, it instinctively gets the average, (1/2,1) and turtle-sprints there 2. The problem is, every turtle is doing this (except, again, 0 and 23 ). So, by the time they have all run to where they think their friends are, their friends have probably sprinted somewhere else, chasing their own friends, which means that the turtles will have to try again. Fortunately, the turtles take a minute to collect their thoughts before needing to sprint again, and they don't try to adjust mid-sprint, or otherwise let themselves get confused. They run to the average of their friends, stop, then re-evaluate. So, the process happens in rounds (or iterations). There is no guarantee that all the turtles will ever be truly satisfied with wherethey stand. What will happen? Well, something like this, when coded properly (here purple is Turtle 0 ; red is the final turtle): Some tips for solving this problem: - It will be useful to make a 2D array to record turtle positions (for each turtle, what is its ( x,y) position). - It will be useful to have a second 2D array to record where the turtles are about to sprint to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!