Turtle Art: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Fix broken link.)
 
(48 intermediate revisions by 19 users not shown)
Line 1: Line 1:
{{Activity migrated to sl.o
| download=http://activities.sugarlabs.org/en-US/sugar/addon/4027
| git=http://git.sugarlabs.org/projects/turtleart
| homepage=http://sugarlabs.org/go/Activities/Turtle_Art
}}

{{translations}}
{{Olpcboxtop|toptext=[[{{PAGENAME}}|Turtle Art]]}}
{{Olpcboxtop|toptext=[[{{PAGENAME}}|Turtle Art]]}}
{{ OBX activity |[[Image:Turtleart.png]]|bundled<!--|{{{text}}}--> }}
{{ OBX activity |[[Image:Turtleart.png]]|bundled }}
{{ OBX source dev|projects/turtleart-activity}}
{{ OBX xobundle|http://hcs.harvard.edu/~sjklein/TurtleArt.xo|Turtle Art}}
{{ OBX test |<!--[[Tests/Turtle Art|Turtle Art]]|2007-09-18--> }}
{{ OBX devtickets |turtleart-activity}}
{{ OBX devtickets |turtleart-activity}}
{{ OBX pootle|http://git.sugarlabs.org/projects/turtleart/repos/mainline/blobs/master/po/TurtleArt.pot|fructose}}
{{ OBX pot
{{ OBX team |Brian Silverman, Walter Bender}}
<!--
| root = [http://translate.fedoraproject.org/module/olpc-write fedora]
| pot = http://translate.fedoraproject.org/POT/olpc-write.master/write.master.pot
| po-root= http://translate.fedoraproject.org/POT/olpc-write.master/
-->
<!-- explicit codes: am, ar, en, es, fr, ha, ig, ne, pt, ro, ru, rw, th, ur, yo // green countries -->
<!--
| ar = write.master.ar.po
| others = [http://translate.fedoraproject.org/POT/olpc-write.master/write.master.pt_BR.po pt_BR]
-->
}}
{{ OBX team |Brian Silverman}}
<small>see more [[:Category:OBX templates|templates]] or [[OBX proposals|propose new]]</small>
{{Olpcboxbottom}}
{{Olpcboxbottom}}


[[Turtle Art]] is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on [[Scratch]]-like snap-together visual programming elements.
Turtle Art is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on [[Scratch]]-like snap-together visual programming elements.


There are many restrictions compared to [[LOGO]]. The two allowed user-defined procedures can't have parameters. Only two numeric global variables are available, no lists or other data-structures. You can't make user defined functions which return a value. The conditionals and some of the functions only take constants or variables, not expressions. Limited screen real-estate makes building large programs unfeasible.
Turtle Art is intended to be a stepping stone to [[Logo]], but there are many restrictions compared to Logo. (Only numeric global variables and stack items are available, no lists or other data-structures. The conditionals and some of the functions only take constants or variables, not expressions. Limited screen real-estate makes building large programs unfeasible.) However, you can export your Turtle Art creations to [[Berkeley Logo]]. Turtle Art also has a (limited) facility for sensor input, so, for example, you can move the Turtle based upon sound volume or pitch.


Turtle Art was written by Brian Silverman and is maintained by Walter Bender. Arjun Sarwal added the sensor features.
Help write the '''[[Turtle Art student guide]]!'''


To download a tutorial intended for children about Turtle Art, go to the '''[[Turtle Art student guide]]!'''. Also, see the [http://en.flossmanuals.net/turtle-art Turtle Art FLOSS Manual]].

'''Note:''' The first time you run Turtle Art, it takes about 30 seconds to load. You'll see a mostly blank screen after the initial flashing of the icon. Subsequently, the loading time is ~5 seconds (on an OLPC-XO-1 laptop).
==Palettes==
==Palettes==
There are five palettes of program elements available for program construction. You add blocks to your program by dragging them from the palette to the main area. You can delete a block by dragging it back onto the palette. Click anywhere on an existing "stack" of blocks to start executing that stack.
There are six palettes of program elements available for program construction. You add blocks to your program by clicking on or dragging them from the palette to the main area. You can delete a block by dragging it back onto the palette. Click anywhere on an existing "stack" of blocks to start executing that stack.

===Turtle (green)===
===Turtle (green)===
*Clean - clear the screen and reset the turtle to center, pointed up (pen down, bright red)
*Clean clear the screen and reset the turtle to center, pointed up (pen down, bright red)
*Forward(n)
*Forward(number) – move turtle forward
*Back(number) – move turtle backward
*Back(n)
*Left(angle)
*Left(angle in degrees) – turn turtle counterclockwise
*Right(angle)
*Right(angle in degrees) – turn turtle clockwise
*Arc(angle,radius)
*Arc(angle in degrees,radius) – move turtle along an arc
*SetYX(xcor,ycor) – move turtle to position (xcor,ycor) [(0,0) is in the center of the screen.]
*SetYX(x,y)
*SetH(heading) – set the heading of the turtle [0 is towards the top of the screen.]
*SetH(heading)

*Turtle state values (can plug into a parameter)
Turtle state values (can plug into a parameter)
**X, Y, heading (Zeros for each are center screen, pointed up. Heading is degrees clockwise.)
**X, Y, heading (Zeros for each are center screen, pointed up. Heading is degrees clockwise.)
**angles are degrees from 0 to 360 (for larger values and smaller values all multiples of 360 are substracted or added to get the value into the range 0..360).
**angles are degrees from 0 to 360 (for larger values and smaller values all multiples of 360 are subtracted or added to get the value into the range 0..360).
** Example: 90 means a right angle clockwise, -30 means a 30 degree angle counterclockwise
** Example: 90 means a right angle clockwise, –30 means a 30 degree angle counterclockwise


===Pen (cyan)===
===Pen (cyan)===
* Pen Up – turtle will not draw when moved
* Pen Up
* Pen Down
* Pen Down – turtle will draw when moved
* Set Pen Size(n)
* Set Pen Size(number) – set size of the line drawn by the turtle
* Set Color(number) – set color of the line drawn by the turtle
* Set Color(n)
* Set Shade(number) – set shade of the line drawn by the turtle
* Set Shade(n)
* Fill Screen(color,shade)
* Fill Screen(color,shade) – fills the background with (color, shade)
* Pen state values (can plug into a parameter)
* Pen state values (can plug into a parameter)
** Pen size, color, shade
** Pen size, color, shade
** Colors and shades are represented by a number from 0 through 99. Using a number outside of this range is allowed, and will cause the value to be "wrapped around" (via a modulo, or "clock arithmetic" operation) to the 0 99 range. Color specifies a hue and shade specifies an admixture of white or black to the color.
** ''Any idea of the allowed ranges of these variables? (Color/shade appears to be Hue/Brightness.)''


This image shows the correspondence between the color's representative number and the actual color itself. NOTE: Some of these colors will appear differently on the XO screen than they do on a standard computer screen. This image is taken from a screenshot on a Macintosh Mini using Firefox to view [http://joviko.net/turtle_art_color.php this webpage].
Colors are represented by a number from 0 through 99. Using a number outside of this range is allowed, and will cause the value to be "wrapped around" (via a modulo, or "clock arithmetic" operation) to the 0 - 99 range.


This image shows the correspondence between the color's representative number and the actual color itself. NOTE: Some of these colors will appear differently on the XO screen than they do on a standard computer screen.
[[Image:Turtle_art_colors.jpg]]
[[Image:Turtle_art_colors.jpg]]

Here is a photograph of the Browser Activity on the XO displaying the original website for the preceding image. It should be taken with a large grain of salt, since it is a photo of a laptop screen, and is thus a pretty poor way to reliably show colors. To see the colors available in Turtle Art, the original website should be viewed on an actual XO.

[[Image:Pic_of_turtle_art_colors_on_xo.jpg]]


===Numbers (violet)===
===Numbers (violet)===
Line 63: Line 63:
**Number (constant)
**Number (constant)
**Infix operators(left,right)
**Infix operators(left,right)
*** +, -, *, /, mod
*** +, , *, /, mod
**Random(min, max) (constants or boxes only)
**Random(min, max) (constants or boxes only)
*Conditions (oval, plugs into an If block)
*Conditions (oval, plugs into an If Block)
** <, >, = (takes two constants or boxes)
** <, >, = (takes two constants or boxes)
** and, or, not (takes other conditions)
** and, or, not (takes other conditions)
*Print(n) - Debugging output. When in full screen mode ('''Alt-Enter'''), show a numeric value at the bottom of the screen.
*Print(number) - Debugging output. When in full-screen mode ('''Alt-Enter'''), show a numeric value at the bottom of the screen.

===Sensors (red)===
*volume
*pitch
*voltage – (As read from mic in on the OLPC-XO-1 laptop)
*resistance – (As read from the mic in on the OLPC-XO-1 laptop)

More details on how to use the sensors can be found on the [[Measure]] Activity page.


===Flow (orange)===
===Flow (orange)===
*Wait(number) – wait specified number of seconds
*Wait(n)
*Forever[stack] (no continuation)
*Forever[stack] (no continuation)
*Repeat(n)[stack]
*Repeat(number)[stack] – loop specified number of times
*If(condition)[then]
*If(condition)[then] – uses boolean operators from Numbers palette
*If(condition)[then][else]
*If(condition)[then][else] – uses boolean operators from Numbers palette
*Stop (no continuation)
*Stop (no continuation)
*Connectors:
*Connectors:
**jog right
**jog right
**jog down
**jog down

===My blocks (yellow)===
===My blocks (yellow)===
*Stack1,2 - a rhombus which tops a stack, equivalent to a procedure definition (but without parameters).
*Stack1,2 a rhombus which tops a stack, equivalent to a procedure definition (but without parameters).
*"Stack1,2" - blocks for invoking a stack (no parameters)
*"Stack1,2" blocks for invoking a stack (no parameters)
*Store in "box" 1,2(n) - blocks for setting a variable
*Store in "box" 1,2(n) blocks for setting a variable
*"Box1,2" (plugs into a parameter)
*"Box1,2" (plugs into a parameter)

**''A glaring limitation: you cannot rename these objects. Thus, you are limited to two procedures and two global variables! Madness! --[[User:IanOsgood|IanOsgood]] 13:59, 30 December 2007 (EST)''
**''A glaring limitation: you cannot rename these objects. Thus, you are limited to two procedures and two global variables! Madness! --[[User:IanOsgood|IanOsgood]] 13:59, 30 December 2007 (EST)''
::As of [http://sugarlabs.org/wiki/images/c/ca/TurtleArt-27.xo TurtleArt-27] there are named boxes and stacks. --[[User:Walter|Walter]] 00:37, 6 January 2009 (UTC)
::As of [http://sugarlabs.org/wiki/images/9/96/TurtleArt-28.xo TurtleArt-28] there is a FILO heap (i.e. parameter stack) along with push and pop blocks. --[[User:Walter|Walter]] 18:15, 7 January 2009 (UTC)


==Program control icons==
==Program control icons==
There are also some icons at the bottom right for user control:
There are also some icons at the top right for user control:
* Show/Hide the current program
* Show/Hide the current program
* Eraser - clear the screen and reset the turtle (same as the Clean block)
* Eraser clear the screen and reset the turtle (same as the Clean block)
* Stop (for infinite loops)
* Stop (for infinite loops)
* Run your program (rabbit icon) – the stack without a "hat" is run at full speed
* Step through your program (turtle icon) – the stack without a "hat" is run with a pause between each step


==Project tab==
==Project tab==
The Project tab at the top left gives access to sample programs shipped with the activity.
The Project tab (at the top left of the toolbar) has a button to access sample programs shipped with the Activity. It also has a export button to save the project into the Journal as a [[Berkeley Logo]] session (logosession.lg),

== Turtle Art with Sensors ==
There is a hack combining some of [[Measure]] with Turtle Art. See [[Turtle Art with Sensors]] for the activity version, and the related [[Measure#Sensor_Input_into_Turtle_Art|Sensor input]] section of the measure page for details about how this was accomplished.


==See also==
==See also==
*[[Etoys]] project TurtleGeometry
*[[Etoys]] project TurtleGeometry
*[[Python]] projects [[PyoLogo]] and [[PyLogo]]
*[[Python]] projects [[PyoLogo]] and [[PyLogo]]
* [http://www.ceibal.edu.uy/portal/recursos/educativos/tortugarte.htm Tutorial de TortugArte] Spanish

{{-}}
{{-}}

==Gallery==
==Gallery==
<gallery>
<gallery>
Line 112: Line 130:
Image:542-turtleart-2.png
Image:542-turtleart-2.png
Image:Turtle-recursion-1.jpg|A recursive algorithm (difficult without parameters)
Image:Turtle-recursion-1.jpg|A recursive algorithm (difficult without parameters)
Image:Screenshot.png|Simple fractal recursion example
Image:TA-Sierpinski.png|Sierpinski Triangle recursion example
Image:Turtle_art_full_spectrum.png|A screen dump of Turtle Art displaying all of the colors and shades that are available within Turtle Art.
Image:Turtle_art_full_spectrum_code.png|The algorithm created by "catmoran" for displaying all of the colors and shades in Turtle Art.
</gallery>
{{stub}}
{{stub}}


[[Category:Games]]
[[Category:Games]]
[[Category:Developers]]
[[Category:Developers]]
{{Activity page
|icon=Image:Turtleart.png
|genre=Programming
|activity group=Activities/G1G1
|short description=Turtle Art is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on snap-together visual programming elements.
|description=Turtle Art is intended to be a stepping stone to [[Logo]], but there are many restrictions compared to Logo. (The two allowed user-defined procedures can't have parameters. Only two numeric global variables are available, no lists or other data-structures. You can't make user defined functions which return a value. The conditionals and some of the functions only take constants or variables, not expressions. Limited screen real-estate makes building large programs unfeasible.) However, you can export your Turtle Art creations to Logo. Turtle Art also has a (limited) facility for sensor input, so, for example, you can move the Turtle based upon sound volume or pitch. Turtle Art was written by Brian Silverman and is maintained by Walter Bender. Arjun Sarwal added the sensor features.
|contact person=User:Walter
}}

Latest revision as of 21:48, 26 November 2011

?Sugar icon}}    This activity is now hosted at the Sugar Activity Library.

The information here is likely to be out-of-date. Consult the new pages for "Turtle Art" first:

  english | español HowTo [ID# 263144]  +/-  
Turtleart.png This activity was bundled
Trac print.png Tickets all - active - new
OlpcProject.png Brian Silverman, Walter Bender

Turtle Art is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on Scratch-like snap-together visual programming elements.

Turtle Art is intended to be a stepping stone to Logo, but there are many restrictions compared to Logo. (Only numeric global variables and stack items are available, no lists or other data-structures. The conditionals and some of the functions only take constants or variables, not expressions. Limited screen real-estate makes building large programs unfeasible.) However, you can export your Turtle Art creations to Berkeley Logo. Turtle Art also has a (limited) facility for sensor input, so, for example, you can move the Turtle based upon sound volume or pitch.

Turtle Art was written by Brian Silverman and is maintained by Walter Bender. Arjun Sarwal added the sensor features.

To download a tutorial intended for children about Turtle Art, go to the Turtle Art student guide!. Also, see the Turtle Art FLOSS Manual].

Note: The first time you run Turtle Art, it takes about 30 seconds to load. You'll see a mostly blank screen after the initial flashing of the icon. Subsequently, the loading time is ~5 seconds (on an OLPC-XO-1 laptop).

Palettes

There are six palettes of program elements available for program construction. You add blocks to your program by clicking on or dragging them from the palette to the main area. You can delete a block by dragging it back onto the palette. Click anywhere on an existing "stack" of blocks to start executing that stack.

Turtle (green)

  • Clean – clear the screen and reset the turtle to center, pointed up (pen down, bright red)
  • Forward(number) – move turtle forward
  • Back(number) – move turtle backward
  • Left(angle in degrees) – turn turtle counterclockwise
  • Right(angle in degrees) – turn turtle clockwise
  • Arc(angle in degrees,radius) – move turtle along an arc
  • SetYX(xcor,ycor) – move turtle to position (xcor,ycor) [(0,0) is in the center of the screen.]
  • SetH(heading) – set the heading of the turtle [0 is towards the top of the screen.]

Turtle state values (can plug into a parameter)

    • X, Y, heading (Zeros for each are center screen, pointed up. Heading is degrees clockwise.)
    • angles are degrees from 0 to 360 (for larger values and smaller values all multiples of 360 are subtracted or added to get the value into the range 0..360).
    • Example: 90 means a right angle clockwise, –30 means a 30 degree angle counterclockwise

Pen (cyan)

  • Pen Up – turtle will not draw when moved
  • Pen Down – turtle will draw when moved
  • Set Pen Size(number) – set size of the line drawn by the turtle
  • Set Color(number) – set color of the line drawn by the turtle
  • Set Shade(number) – set shade of the line drawn by the turtle
  • Fill Screen(color,shade) – fills the background with (color, shade)
  • Pen state values (can plug into a parameter)
    • Pen size, color, shade
    • Colors and shades are represented by a number from 0 through 99. Using a number outside of this range is allowed, and will cause the value to be "wrapped around" (via a modulo, or "clock arithmetic" operation) to the 0 – 99 range. Color specifies a hue and shade specifies an admixture of white or black to the color.

This image shows the correspondence between the color's representative number and the actual color itself. NOTE: Some of these colors will appear differently on the XO screen than they do on a standard computer screen. This image is taken from a screenshot on a Macintosh Mini using Firefox to view this webpage.

Turtle art colors.jpg

Here is a photograph of the Browser Activity on the XO displaying the original website for the preceding image. It should be taken with a large grain of salt, since it is a photo of a laptop screen, and is thus a pretty poor way to reliably show colors. To see the colors available in Turtle Art, the original website should be viewed on an actual XO.

Pic of turtle art colors on xo.jpg

Numbers (violet)

  • Values (can plug into a parameter)
    • Number (constant)
    • Infix operators(left,right)
      • +, –, *, /, mod
    • Random(min, max) (constants or boxes only)
  • Conditions (oval, plugs into an If Block)
    • <, >, = (takes two constants or boxes)
    • and, or, not (takes other conditions)
  • Print(number) - Debugging output. When in full-screen mode (Alt-Enter), show a numeric value at the bottom of the screen.

Sensors (red)

  • volume
  • pitch
  • voltage – (As read from mic in on the OLPC-XO-1 laptop)
  • resistance – (As read from the mic in on the OLPC-XO-1 laptop)

More details on how to use the sensors can be found on the Measure Activity page.

Flow (orange)

  • Wait(number) – wait specified number of seconds
  • Forever[stack] – (no continuation)
  • Repeat(number)[stack] – loop specified number of times
  • If(condition)[then] – uses boolean operators from Numbers palette
  • If(condition)[then][else] – uses boolean operators from Numbers palette
  • Stop (no continuation)
  • Connectors:
    • jog right
    • jog down

My blocks (yellow)

  • Stack1,2 – a rhombus which tops a stack, equivalent to a procedure definition (but without parameters).
  • "Stack1,2" – blocks for invoking a stack (no parameters)
  • Store in "box" 1,2(n) – blocks for setting a variable
  • "Box1,2" (plugs into a parameter)
    • A glaring limitation: you cannot rename these objects. Thus, you are limited to two procedures and two global variables! Madness! --IanOsgood 13:59, 30 December 2007 (EST)
As of TurtleArt-27 there are named boxes and stacks. --Walter 00:37, 6 January 2009 (UTC)
As of TurtleArt-28 there is a FILO heap (i.e. parameter stack) along with push and pop blocks. --Walter 18:15, 7 January 2009 (UTC)

Program control icons

There are also some icons at the top right for user control:

  • Show/Hide the current program
  • Eraser – clear the screen and reset the turtle (same as the Clean block)
  • Stop (for infinite loops)
  • Run your program (rabbit icon) – the stack without a "hat" is run at full speed
  • Step through your program (turtle icon) – the stack without a "hat" is run with a pause between each step

Project tab

The Project tab (at the top left of the toolbar) has a button to access sample programs shipped with the Activity. It also has a export button to save the project into the Journal as a Berkeley Logo session (logosession.lg),

Turtle Art with Sensors

There is a hack combining some of Measure with Turtle Art. See Turtle Art with Sensors for the activity version, and the related Sensor input section of the measure page for details about how this was accomplished.

See also


Gallery

This article is a stub. You can help the OLPC project by expanding it.

Activity Summary

Icon: Sugar icon::Image:Turtleart.png
Genre: Activity genre::Programming
Activity group: ,|x|Activity group::x}}
Short description: Short description::Turtle Art is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on snap-together visual programming elements.
Description:
Maintainers: ,|x|Contact person::x}}
Repository URL:
Available languages: ,|x|Available languages::x}}
Available languages (codes): ,|x|Language code::x}}
Pootle URL:
Related projects: Related projects,|x|Related projects::x}}
Contributors: ,|x|Team member::x}}
URL from which to download the latest .xo bundle Activity bundle::
Last tested version number:
The releases with which this version of the activity has been tested. ,|x|Software release::x}}
Development status:
Ready for testing (development has progressed to the point where testers should try it out): ,|x|Ready for testing::x}}
smoke tested :
test plan available :
test plan executed :
developer response to testing :