course_planning:code-testing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
course_planning:code-testing [2024/01/19 13:27] caballerocourse_planning:code-testing [2024/01/19 13:44] (current) caballero
Line 1: Line 1:
-====== Basic ======+# Embedded Code Testing
  
-<Code: python>+## Basic 
 + 
 +### Syntax 
 + 
 +``` 
 +<code python> 
 +{YOUR CODE} 
 +</code> 
 +``` 
 + 
 +### Example 
 + 
 +<code python>
 Web VPython 3.2 Web VPython 3.2
  
Line 37: Line 49:
     if not (side > ball.pos.z > -side):     if not (side > ball.pos.z > -side):
         ball.p.z = -ball.p.z         ball.p.z = -ball.p.z
-</Code>+</code>
  
-===== With Title and Line Numbers ===== 
  
-<Code: python linenums: | Model of a Bouncing Ball >+## With Line Numbers and Highlighting 
 + 
 +### Syntax 
 + 
 +``` 
 +<code python [enable_line_numbers="true", highlight_lines_extra="ARRAY_OF_LINE_NUMBERS"]> 
 +{YOUR CODE} 
 +</code> 
 +``` 
 + 
 +### Example 
 + 
 +<code python [enable_line_numbers="true", highlight_lines_extra="27,29"]>
 Web VPython 3.2 Web VPython 3.2
  
Line 77: Line 100:
     if not (side > ball.pos.z > -side):     if not (side > ball.pos.z > -side):
         ball.p.z = -ball.p.z         ball.p.z = -ball.p.z
-</Code>+</code> 
 + 
 + 
 +## With Line Numbers, Highlighting, Title, and ReNumbering 
 + 
 +### Syntax 
 + 
 +``` 
 +<code python [enable_line_numbers="true", highlight_lines_extra="ARRAY_OF_LINE_NUMBERS", start_line_numbers_at="NUMBER"] | TITLE> 
 +{YOUR CODE} 
 +</code> 
 +``` 
 + 
 +**Note: Highlighting lines uses an absolute number (i.e., the given number of lines sets the length and order starting from 1).** 
 + 
 +### Example 
 + 
 +<code python [enable_line_numbers="true", highlight_lines_extra="4,6,8", start_line_numbers_at="27"] | Focusing on the Loop > 
 +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 
 +</code>
  • course_planning/code-testing.1705670866.txt.gz
  • Last modified: 2024/01/19 13:27
  • by caballero