27 lines, 4 of them comments ยท 281 tokens, written in 11 seconds for $0.0001


 1  function setup() {
 2    createCanvas(400, 400);
 3    // Initialize the position and speed of the circle
 4    circleX = 200;
 5    circleY = 200;
 6    speedX = 2;
 7    speedY = 2;
 8  }
 9  
10  function draw() {
11    background(220);
12    // Draw the circle
13    fill(0);
14    ellipse(circleX, circleY, 50, 50);
15    
16    // Update the position of the circle
17    circleX += speedX;
18    circleY += speedY;
19    
20    // Check for collision with the edges of the canvas
21    if (circleX < 25 || circleX > 375) {
22      speedX *= -1;
23    }
24    if (circleY < 25 || circleY > 375) {
25      speedY *= -1;
26    }
27  }