# Embedded Code Testing

## Basic

### Syntax

```

{YOUR CODE}

```

### Example

Web VPython 3.2
 
scene.caption = """To rotate "camera", drag with right button or Ctrl-drag.
To zoom, drag with middle button or Alt/Option depressed, or use scroll wheel.
  On a two-button mouse, middle is left + right.
To pan left/right and up/down, Shift-drag.
Touch screen: pinch/extend to zoom, swipe or two-finger rotate."""
 
side = 4.0
thk = 0.3
s2 = 2*side - thk
s3 = 2*side + thk
 
wallR = box (pos=vector( side, 0, 0), size=vector(thk, s2, s3),  color = color.red)
wallL = box (pos=vector(-side, 0, 0), size=vector(thk, s2, s3),  color = color.red)
wallB = box (pos=vector(0, -side, 0), size=vector(s3, thk, s3),  color = color.blue)
wallT = box (pos=vector(0,  side, 0), size=vector(s3, thk, s3),  color = color.blue)
wallBK = box(pos=vector(0, 0, -side), size=vector(s2, s2, thk), color = color.gray(0.7))
 
ball = sphere (color = color.green, radius = 0.4, make_trail=True, retain=200)
ball.mass = 1.0
ball.p = vector (-0.15, -0.23, +0.27)
 
side = side - thk*0.5 - ball.radius
 
dt = 0.3
while True:
    rate(200)
    ball.pos = ball.pos + (ball.p/ball.mass)*dt
    if not (side > ball.pos.x > -side):
        ball.p.x = -ball.p.x
    if not (side > ball.pos.y > -side):
        ball.p.y = -ball.p.y
    if not (side > ball.pos.z > -side):
        ball.p.z = -ball.p.z

## With Line Numbers and Highlighting

### Syntax

```

  1. {YOUR CODE}

```

### Example

  1. Web VPython 3.2
  2.  
  3. scene.caption = """To rotate "camera", drag with right button or Ctrl-drag.
  4. To zoom, drag with middle button or Alt/Option depressed, or use scroll wheel.
  5. On a two-button mouse, middle is left + right.
  6. To pan left/right and up/down, Shift-drag.
  7. Touch screen: pinch/extend to zoom, swipe or two-finger rotate."""
  8.  
  9. side = 4.0
  10. thk = 0.3
  11. s2 = 2*side - thk
  12. s3 = 2*side + thk
  13.  
  14. wallR = box (pos=vector( side, 0, 0), size=vector(thk, s2, s3), color = color.red)
  15. wallL = box (pos=vector(-side, 0, 0), size=vector(thk, s2, s3), color = color.red)
  16. wallB = box (pos=vector(0, -side, 0), size=vector(s3, thk, s3), color = color.blue)
  17. wallT = box (pos=vector(0, side, 0), size=vector(s3, thk, s3), color = color.blue)
  18. wallBK = box(pos=vector(0, 0, -side), size=vector(s2, s2, thk), color = color.gray(0.7))
  19.  
  20. ball = sphere (color = color.green, radius = 0.4, make_trail=True, retain=200)
  21. ball.mass = 1.0
  22. ball.p = vector (-0.15, -0.23, +0.27)
  23.  
  24. side = side - thk*0.5 - ball.radius
  25.  
  26. dt = 0.3
  27. while True:
  28. rate(200)
  29. ball.pos = ball.pos + (ball.p/ball.mass)*dt
  30. if not (side > ball.pos.x > -side):
  31. ball.p.x = -ball.p.x
  32. if not (side > ball.pos.y > -side):
  33. ball.p.y = -ball.p.y
  34. if not (side > ball.pos.z > -side):
  35. ball.p.z = -ball.p.z

## With Line Numbers, Highlighting, Title, and ReNumbering

### Syntax

```

| TITLE
  1. {YOUR CODE}

```

Note: Highlighting lines uses an absolute number (i.e., the given number of lines sets the length and order starting from 1).

### Example

| Focusing on the Loop
  1. while True:
  2. rate(200)
  3. ball.pos = ball.pos + (ball.p/ball.mass)*dt
  4. if not (side > ball.pos.x > -side):
  5. ball.p.x = -ball.p.x
  6. if not (side > ball.pos.y > -side):
  7. ball.p.y = -ball.p.y
  8. if not (side > ball.pos.z > -side):
  9. ball.p.z = -ball.p.z