Example #1
0
int main(){
    PROG test_prog = create_forward(160);
    add_node(test_prog, create_left(90));
    add_node(test_prog, create_forward(160));
    PROG rep_prog = create_forward(0.5);
    add_node(rep_prog, create_left(1));
    NODE* rep_node = create_repeat(360, rep_prog);
    add_node(test_prog, rep_node);
    print_logo(test_prog, 0, 2);
    //print_svg(test_prog);
    free_prog(test_prog);
    return 0;
}
Example #2
0
/*
 * forward(speeed, centimeters):
 *   -- Moves the robot FORWARD the given distance in centimeters)
 *        at the given speed (in centimeters / second).
 * 
 * Speed and distance must be non-negative integers.
 
 * The   ROBOT   variable determines whether this is the Lego
 *   or Create robot.
 */
void forward(int speed, int centimeters)
{
	if (ROBOT == LEGO_ROBOT)
	{
		lego_forward(speed, centimeters);
	}
	else if (ROBOT == CREATE_ROBOT)
	{
		create_forward(speed, centimeters);
	}
	else
	{
		printf("ERROR:\n");
		printf("The ROBOT must be LEGO_ROBOT or CREATE_ROBOT.\n");
	}
}