AutoHotkey | Android | Arduino | COMM140 | Fractals | Grammar Checkers | Knots | A Million Dots Activity | Processing | Processing for Scratch Users | Redbubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.
Home > MicroWorlds Logo Links & Examples > Elements of Programming MicroWorlds LOGO
Logo programming language
From Wikipedia, the free encyclopedia.
http://en.wikipedia.org/wiki/Logo_programming_language
How to Think Like a Computer Scientist
http://ibiblio.org/obp/thinkCS/
increment2.mw2 20
KB increment2 source code |
Using a counter |
make "counter 0 ;
create the counter
|
|
September 4, 2004 counter.mw2
13 KB |
Using a counter |
to
go make "x 0 ; define x make "stop_at (random 19) + 1 ; > 0 < 21 cc show (word [The counter will stop at] char 32 :stop_at) ct ;
clear text box |
|
sliders.zip 3KB use winzip to unzip
|
Playing with sliders Demonstrates how to set sliders and how to use the value of sliders within a procedure. Also provides an example of turning on & off a button from with a procedure. |
This also creates a simple etch-a-sketch program using sliders to move the turtle around. to move_turtle All that is required for the above etch-a-sketch to work are 4 sliders named: pen_size ;
minimum value 1 maximum value 100 and a button with the instruction move_turtle set to Many Times |
|
to
test test t7 |
|
check_boxes.zip 5KB |
Implementing Check Boxes in MicroWorlds |
detention.mw2
19 KB |
to
go to do_detention print (se :counter "I "must "not "ridicule "the "detention "system.) make "counter :counter + 1 ;
count the lines |
if if true-or-false list-to-run Runs the instruction list only if the condition (first input) reports true. Examples: if colorunder = 15 [bk 50] |
|
ifelse
ifelse true-or-false instruction-list1 instruction-list2 Runs the first instruction list if the condition is true. Runs the second instruction list if the condition is false. Example: ifelse colorunder = 15 This instruction can be used to get an answer to a question dialog box. If the answer is not empty, it is displayed in a text box. to insist ifelse empty? answer |
|
colorunder
Reports the color under the current turtle as a number. The portion of a turtle that recognizes a color is its center. Colorunder reports the background color as well as all the drawings. Example: t1, show colorunder 3 In a stop rule, always use the color number, not its name, to check the color under the turtle: if colorunder = 15 [announce [You win!]] Colorunder reports not only integers but also decimal numbers. Note that when MicroWorlds reports decimal numbers, it may report a slightly different number than the one expected. This is due to the recalculation of the RGB color. setc 105.6 fill show colorunder 105.4 setc 17.2 fill show colorunder 17.1 Note: In order to use the full potential of MicroWorlds graphics, 16 bit color mode is recommended. |
|
fill Fills a closed shape or the whole screen with the turtle's
color. Fill will work regardless of the turtle's pen state (up or down).
See setc. pd repeat 5 [fd 50 rt 72] Drag the turtle inside the area. setc "blue |
|
freezebg Stands for freeze background. Freezes the background graphics
in their current state. You can still draw over the background and erase
the new drawings, but the background that was present before freezing
won't be erased. See unfreezebg. pd |
|
mousepos Stands for mouse position. Reports the page coordinates representing the current mouse position on the screen. See setpos. Examples: show mousepos show first mousepos If there is a turtle on the page, the turtle will follow the mouse. t1, Choose the Cancel menu item, the Stop All menu item, or Ctrl+Break to stop this process. |
|
Random random number Reports a random non-negative integer less than number. Example: show random 100 22 This procedure will simulate the roll of a die: to die show 1 + random 6 end |
|
setinstrument
setinstrument name-or-number Sets the instrument for the next note commands. There are 7 instrument names: piano, harpsichord vibraphone, guitar, violin, clarinet, and kalimba. You can also use any number from 1 to 128. Examples: setinstrument "violin note 65 10 setinstrument 116 note 65 10 |
|
towards
towards turtle-name Sets the heading of the current turtle to aim towards the one whose name is given as input. See distance. Example: t1, towards "t2 T1 faces t2. |
|
APA citation:
Russell, R. (2016, July 04, 02:14 pm). Elements of programming microworlds logo.
Retrieved November 22, 2024, from http://www.rupert.id.au/microworlds/programming.php
Last refreshed: November 22 2024. 09:55.17 am
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.