
-----------------------------------
moneyhoney
Tue Mar 05, 2013 2:52 pm

Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
Exercise: 5.	Draw 40 small circles starting at the middle left of the screen extending to the middle right of the screen.  Make each circle a random color.

left question at school, in case you guys know how. I'll write up a new one, editing this thread soon.

-----------------------------------
Raknarg
Tue Mar 05, 2013 4:58 pm

RE:Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
Are you asking us to program it for you?

-----------------------------------
moneyhoney
Tue Mar 05, 2013 7:03 pm

Re: RE:Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
Are you asking us to program it for you?

No

var circleCount : int
var circleColour : int
var x : int
var y : int

y := maxy div 2
x := 15
circleCount := 0
loop
    randint (circleColour, 1, 255)
    Draw.FillOval (x, y, 15, 15, circleColour)

    circleCount := circleCount + 1
    x := x + 15
end loop

I need to know how to make it 40 circles.

-----------------------------------
evildaddy911
Tue Mar 05, 2013 7:37 pm

Re: Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
the infinite loop will make an infinite amount of circles. do you know how to repeat a fixed number of times?
hint: try a different type of loop

-----------------------------------
Raknarg
Wed Mar 06, 2013 7:53 pm

RE:Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
or in case they dont know already... Basically every language has a structure called a for loop, which loops for only a specific amount of iterations.

In this case, it's structured like this:

for i : 1 .. n

end for

i being what you want to call the loop, and n being the number of times for it to iterate.

-----------------------------------
KingGrumpz
Thu Mar 07, 2013 9:49 pm

RE:Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
if you want to keep the code you have use an exit when statement
(Ex. exit when Letter = "a")

-----------------------------------
Raknarg
Sat Mar 09, 2013 6:17 pm

RE:Drawing Circrles from left to right, 40 total, random colors
-----------------------------------
Or, you know, teach him a much better concept
