header

 

More links

AutoHotkey | Android | Arduino | COMM140Fractals | Grammar Checkers | Knots | A Million Dots Activity |  Processing | Processing for Scratch Users | RedBubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.

Home > MicroWorlds Logo (Turtle Graphics) Links & Examples > Examples > MicroWorlds Input & Control

MicroWorlds Input & Control

The following programs are a collection of examples most of which I have created for my own amusement or as
teaching aids. You are welcome to download copies and play with them. You may also place copies on your website as long as you add a link to this page and e-mail me details of where you are using them.

If you switch to the procedures page using Ctrl + F or Pages | Procedures you will see that most of these examples use procedures. if the example has no procedures then right click on the turtle and see if there is any code programmed directly into the turtle.

Colours can also have code associated with them. Click on the Paint Brush button to view the colour pallet.
any colours with a black dot in the center of the colour has logo code programmed into it. Double click on the colour to view the associated code.

Note: these example programs are written using MicroWorlds Version 2.05

The Following MicroWorlds programs are free software; you can redistribute and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

MicroWorlds Triangles and Squares

random_tri_sq.zip 38KB Ziped with Winzip  from www.winzip.com

use winzip to unzip

Get MicroWorlds Web Player Plugin version

to click_switch
   if :click_switch = "false [
      ; ----- if the switch was off turn it on
      ;       turn the variable click_switch to true

      make "click_switch "true
      make "fill_shapes "true
      check_switches
      
stop                        ; stop the procedure
   ]

   if :click_switch = "true [
      ; ----- if the switch was on turn it off and...
      ;       change the value of click_switch

      make "click_switch "false
      make "fill_shapes "false
      check_switches              ; call check_switches
   ]

end

to check_switches
   ; ----- show the value of fill in the text box
   ifelse :fill_shapes = "true [
      set "text1 "text (se [fill is true])
      tr_click, setsh "click_on  ; turn on the click switch
      tr_push, setsh "push_on    ; turn on the click switch
   ]
      make "fill "false
      set "text1 "text (se [fill is false])
      tr_click, setsh "click_off ; turn off the click switch
      tr_push, setsh "push_off   ; turn off the click switch
   ]
end

Draws random triangles & squares, Produces nice 50's style table top designs. Demonstrates one way to implement push buttons using turtles to control a try / false variable.

MicroWorlds on a tangent

on_a_tangent.zip 9KB Ziped with Winzip  from www.winzip.com use winzip to unzip

Note this project demonstrates the use of Check Boxes

Inspired by the online essay going in circles
http://llk.media.mit.edu/projects/circles/

http://llk.media.mit.edu/projects/circles/tangent.html

MicroWorlds One Good Turn Check Boxes

Updated January 24, 2005

one_good_turn.mw2 27 KB
one_good_turn.zip 13 KB
one_good_turn.exe 76 KB

GNU License.txt

Published under the GNU GPL

Demonstrates the use of radio buttons

Inspired by the online essay going in circles
http://llk.media.mit.edu/projects/circles/

http://llk.media.mit.edu/projects/circles/onegoodturn.html

MicroWorlds Etch-a-sketch

etch-a-sketch2.zip 4KB Ziped with Winzip  from www.winzip.com use winzip to unzip

Etch-a-sketch

a work in progress

MicroWorlds flower.zip

MicroWorlds flower.zip

flower.zip 388KB Ziped with Winzip  from www.winzip.com use winzip to unzip

In this example the colours cyan and magenta are programmed to show a text box containing information for eight seconds, and then hide the information again.

 

MicroWorlds radio buttons

radio_buttons.zip 11KB Ziped with Winzip  from www.winzip.com use winzip to unzip

This project demonstrates one way to implement radio buttons in MicroWorlds.

MicroWorlds radio buttons


October 21, 2004

move_turtle2.mw2 29 KB

 

Move the turtle using the cursor keys

Yet another more complex version of move_turtle0

This is an example of creeping featurisim. I could not help adding the ability to lift the turtle using U for pu and then I had to have D for pd and then I had to be able to see the diffierence between when the turtle was up and down. And then I added colours and then I though what about white...

This is always a risk when writing programs. Creeping featurisim is also known as program bloat.

 

October 21, 2004

move_turtle3.mw2 82 KB
move_turtle3.zip 36 KB
move_turtle3.exe 96 KB

move_turtle3 source code

Get MicroWorlds Web Player Plugin version
GNU License.txt

Published under the GNU GPL

 

Another more complex version of move_turtle0

This version uses features from Art2 to colour the turtle as it moves

 

MicroWorlds making turtles
August 9, 2004

make_turtles.mw2 52 KB

make_turtles.zip 10 KB Ziped with Winzip  from www.winzip.com use winzip to unzip

Uses Sliders for Input

Demonstrates how to make and remove turtles using procedures

based on code from: http://www.microworlds.com/library/math/geoboard/geoboard.zip

to remove_all_turtles

  newturtle "create_a_dummy_turtle ; this is necessary
                                   ; to make sure that there
                                   ; is a current turtle

  make "number_of_turtles count get first pagelist "turtles
  repeat :number_of_turtles [
    carefully [remove who][]       ; remove current turtle
    ]
end

 


October 21, 2004

move_turtle0.mw2 18 KB
move_turtle0.zip 11 KB
move_turtle0.exe 72 KB

move_turtle0 source code

Get MicroWorlds Web Player Plugin version
GNU License.txt

Published under the GNU GPL

Move the turtle using the cursor keys
to startup
   make "step 50
   setpensize 5
   move_turtle
end

to move_turtle

   pd

   ; read the key pressed
   make "ch ascii readchar

   if :ch = 38 [t1, seth 0 fd :step]   ; north
   if :ch = 40 [t1, seth 180 fd :step] ; south
   if :ch = 39 [t1, seth 90 fd :step]  ; east
   if :ch = 37 [t1, seth 270 fd :step] ; west

   ;setc (random 15) + 125 ; add some colour
   setc "black

   move_turtle ; repeat the whole process again

end

January 23, 2005

harmonograph.mw2 90KB

GNU License.txt

Published under the GNU GPL

Draws harmonographs

Based on code from http://www.mulawa.net/mulawa/projects/index.html

Andrew Purdam has produced equations that allow one to explore the beauty of the harmongraph without building one....not that building one is any less satisfying. His equations are:
x(t) = Ax(t) sin(wx + px) + As(t) sin(ws + ps)

y(t) = Ay(t) sin(wy + py)

All initial amplitudes, frequencies (w) and phases (p) should be different and not integer multiples for the most complicated (interesting) patterns.

In order for the amplitude to decay (not necessary but occurs in the real harmonograph) the amplitudes can decay as follows, where d is typically a suitable small positive number. This gives an exponential decay function.
A(t) = A(t-1) (1 - d)


April 20, 2005

everyone.mw2 14 KB

GNU License.txt

Published under the GNU GPL

Demonstrates starting turtles & music at the same time


to go
   everyone [clickon]
   melody1
end

to halt
   everyone [clickoff]
   set "melody1 "on? "false
end

APA citation:
Russell, R. (2016, July 04, 02:14 pm). Microworlds input & control.
     Retrieved March 29, 2024, from http://www.rupert.id.au/microworlds/input.php


Last refreshed: March 29 2024. 09:22.26 pm

rupert dot russell at acu dot edu dot au Support Wikipedia

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.


713 Visits since November 28, 2003