Programming : Sample program
FYI, some sample programs. The image is drawn by the program.
Drawing a triangle
Drawing a triangle with the Loop block
You can use the Loop block to do the same process repeatedly.
Drawing triangles of different sizes.
By using the Loop block twice, you can increase the number of times of repetition.
It draws triangles of the side length to be R0, 10 times, with adding 10 to R0 for each triangle.
Following programs can not be created in the Novice mode. Switch to the Normal mode to create these programs.
Drawing triangles with different sizes by using the User Block
The main program
|
|
The contents of the User Block "Draw a triangle" |
|
You can define a User Block that contains some sequence of blocks.
In this case, the blocks of drawing a triangle are define as one User Block.
A sample of a Recursive process
|
|
The contents of the User Block "Recursive drawing of a triangle" |
This is a sample that use a recursive process. It uses the same User block in a User Block.
If you change the comparison value of the 2nd block in the User block to a smaller value (like 5), it increases the recursive times and the drawing will be more complicated.
If you do so, you may use the Width block () to draw narrower lines.
A Simple animation
|
Image is omited |
This is a sample of an animation.
To run this program, you should check "Run Fastest" to see the animation.
Back to How to Use.