# [Tutor] Seeking Help for CMU CS Academy - Spinning Arcs

Alan Gauld alan.gauld at yahoo.co.uk
Fri Jan 15 18:41:21 EST 2021

```On 15/01/2021 14:00, Kevin Andreyo via Tutor wrote:

> ...just not understanding what the code means by “updating” > the start and sweep angles. I can’t seem to get my angles
> to change at all.

> This is my code…
>
> app.background = rgb(0, 0, 60)
> arcs = Group()
>
> for i in range(10):
>     arc1 = Arc(200, 200, ...
>     arc2 = Arc(200, 200, ...
>     ...

In the above code you create a group and add arc pairs.

In the code below you define two functions but
neither is ever called. So they do nothing.

> def moveArcs(arc):
>     ### Place Your Code Here ###
>     for arc in arcs.children:
>         if(0>arc.sweepAngle>=340):
>             arc1.dS=-arc1.dS
>             arc2.dS=-arc2.dS
>     # Update the start and sweep angles of the arc.
>     ### Place Your Code Here ###
>         arc.startAngle=arc1.dA
>         arc.sweepAngle=arc1.dS
>     # When the start angle gets to 360, reset it to 0.
>     ### Place Your Code Here ###
>         if(arc.startAngle>=360):
>             arc.startAngle=0
>
> def onStep():
>     for arc in arcs.children:
>         moveArcs(arc)

So how is onStep ever called?
Remember we are not doing your course and have no idea
how this framework operates. You need to guide us.
Its not clear if some piece of code swe cannot see
is calling onstep or whether you are supposed to call
it explicitly - BUt how? From where?

One thing that does seeem odd to me is that onStep loops over
arcs.children and calls moveArcs.
But the first thing movearcs does is loop over arcs.children?
So effectively you code does this:

for arc1 in arcs.children:
for arc2 in arcs.children:
# do stuff

Is that right?

The other thing I notice is that you pass the current
arc into moveArcs as 'arc' But you also use arc in
the loop which means you immediately throw away the
value passed into the function and replace it with
the for loop value. That is almost certainly wrong.

I can't say much more because the code and descriptions
are not complete enough to make any sense of things.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

```