C++
ADVANCED
As Artie Max draws, follow along
onscreen. Watch what each coded
command produces on the page.
WATCH & LEARN
DOWNLOAD
You can also download the
complete code for this project.
Just find the “
INFINITE LOOP
”
project from the file menu.
SAVE
SAVE AS...
NEW PROGRAM
DELETE PROGRAM
DOWNLOAD
CURRENT PROGRAM
UPLOAD PROGRAM
DEMO:
• INFINITE LOOP
#include <iostream>
#include <artie>
Artie artie;
void draw_arc(char *direction, float fraction, float radius)
{
float L = 78;
float PI = 3.141592;
float distance = PI * 2.0 * radius * fraction;
float angle = atan(L/radius) * 180/PI;
if (direction == 'left'){
angle = -angle;
}
artie.movearc(distance, angle);
}
int main() {
artie.pendown(1);
artie.left(90);
draw_arc('right', (1.0/2.0), 50.0);
artie.right(1);
artie.pendown(2);
draw_arc('right', (73.0/360.0), 69.0);
artie.right(1);
draw_arc('left', (73.0/360.0), 69.0);
artie.left(1);
artie.pendown(3);
draw_arc('left', (1.0/2.0), 50.0);
artie.left(1);
artie.pendown(2)
draw_arc('left', (73.0/360.0), 69.0);
artie.left(1);
draw_arc('right', (73.0/360.0), 69.0);
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
PROGRAM
Copy the text that you see below:
INFINITE LOOP
RUN
Center
Artie Max
on the
paper.
Always test your code
in the Simulator first.