Hi!
I've coded two classes that create an array of the circle object and then move this array of circles by means of redrawing its position in the window.
The circles move clockwise at first and at each move there is a probability, as input by the user, that they are going to change direction. When they change direction the circles cannot again move clockwise. This is what the code below does.
What I need to do to complete the program is to stop the animation when all circles are moving anticlockwise. I've written the following steps, but I am having difficulties coding them in
Java.
1. Check the position of each circle (i.e. whether it's moving clockwise or anticlockwise)
2. If it's moving anticlockwise then count the circle.
3. Repeat for all other circles.
4. When all circles are moving anticlockwise stop the animation.
I've figured out that an animation is stopped by the construct if (...) { }.
Can anybody help me code the above four steps into Java?
Below is the code of the two classes.