to prepare a serial version of a program to illustrate patterns
of Gator fan coloring. Gators are fond of the colors orange and blue. They tend to
dress in either one color or the other and frequently change their minds about their
color based on the colors of the people they can see around them. Simulating this
can be done on a computer and interesting patterns will develop over time which
you will be able to display as a movie of orange and blue spheres.

Recommended Answers

All 7 Replies

Okay. That's nice. Is there a question in there somewhere?

no can u please send the solution that how to navigate from orange to blue in gators

No.

Give it a try then paste your own effort.

See if you can find the thread posted yesterday that does a much better job of asking this question.

Here's a hint: You'll need srand(), rand(), and at least 3 loops.

Gator Life
Ray Seyfarth
September 14, 2010
Abstract
Your assignment is to prepare a serial version of a program to illustrate patterns
of Gator fan coloring. Gators are fond of the colors orange and blue. They tend to
dress in either one color or the other and frequently change their minds about their
color based on the colors of the people they can see around them. Simulating this
can be done on a computer and interesting patterns will develop over time which
you will be able to display as a movie of orange and blue spheres.
1 The Collection of Gators
Your collection of gators will be a 3D cube lled with Gators. Initially the fans will be
colored randomly either orange or blue with equal probability. Subsequently each Gator
will observe its 6 adjacent neighbors and might choose to change color.
The cube size will be n n n where n is a command line parameter. There will
be n3
Gators in the cube. For simplicity you represent a Gator as a single signed integer
(signed char will work). You can easily manage arrays using the Array template class
in array.t or the similar class in the blitz++ library. To simplify the code the problem
will require using wrap-around in all 3 dimensions, so it will be useful to create the array
as (n + 2) (n + 2) (n + 2).
Also the values to represent orange and blue should probably be -1 and 1 to make
the program easier to write.
2 Changing Colors based on Neighbors
Your program will go through a series of time steps using a value s also obtained from
the command line. In each time step you will need to perform n3
attempts at color
changes. In each attempt your program should select a position in the cube at random
and attempt to change that fan's color.
The attempt to change a fan's color will be based on it's value ( 1 or 1) and the
values of its 6 nearest neighbors. With a cube with indexes from 0 to n+1, your randomly
1selected fan will have indices from 1 to n and will denitely have 6 nearest neighbors.
To spice things up we will use a value f as a measure of fanaticism. f will also be a
command line parameter.
To decide whether to
ip a fan's color do these steps:
1. Compute the sum of the 6 neighbors' values as sum.
2. Compute sum times the fan's value times 2 and save as g.
3. If g is 0 or negative,
ip the color and move on to the next fan.
4. Compute a random value r from 0 to 1.
5. If r is less than e g=f
then
ip the color.
3 Making a Movie
To help with debugging and to make it all more interesting, you will need to make a
movie of state of your cube at each time step. The movie will be made using the animp
library which will be explained in class.
4 Deliverables
1. Source code in C++
2. Report describing the eects of the f parameter over an interesting range. I suggest
using a little experimentation starting with f = 1.
The animp program can create an image of a frame of a movie, so you should include
pictures in your report.
2

Is this a joke?
Can you do it for me i can't be bothered?

i am sending whole problem please send source code in c++

commented: Take a hint. Either show some effort and attempt it yourself, or get lost. +0

NO.
(as noob don't know if i could do this, but even if i could answer would be NO.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.