First Animation Homework

1. There's a famous constant, called "e" whose value is approximately 2.71828182...
Its value can be calculated using the series:

e = 1/0! + 1/1! + 1/2! + 1/3! + .... 

Calculate this sum until (and including) the term 1/9!  Copy the code that does this calculation as well as the result into the Comments-to-Teacher.

2. Create the sketch that does this.  Here is a template for the code.  Upload your .pde file to the homework server slot.

 
int x,y,radius;
int direction;  // 0=right, 1=down, 2=left, 3=up
int step;


void setup() {
  size(600,400);
  radius = 30;
  x = radius;
  y = radius;
  direction = 0;
  step = 4;
}

void draw() {
  background(??);

  fill(??);
  noStroke();
  circle(??);
 
  if (direction == 0) {
     ??
  }
  else if (direction == 1) {
       ??
  }
  else if (direction == 2) {
      ??
  }
  else {
    ??
  }
}