Screen: grid     Editor: form  
Your browser doesn't support the HTML5 canvas. Please upgrade to a more recent web browswer.
 Command Line:       Speed:  
Guide | Reference | Library
Welcome to iLogo a small turtle graphics interpreter Quick Start =========== iLogo starts with the turtle in the centre of the screen with the pen down. Type 'fd 40' into the Command Line and press keyboard ‹return› key to run the code. The turtle will draw a line. If the command line is empty, ‹return› will recall the previous instruction. Press ‹return› to run again. Open the 'Library' tab and select a program. It will be copied into the editor. Click the 'Run' button and the turtle will follow each instruction step by step. You can change the speed while it is drawing. Click 'Stop' if you need to stop the turtle. Note: The Run button runs code in the Command Line, if there is any. If it is empty, code in the Editor is run. The text output screen overlays the turtle graphics screen. Output text can be copied but not edited. The turtle and output text are always white. Use the 'form' button to expand or contract common shortforms. CS, CT, FD, BK, RT, LT, PU, PD, RA, LA, ST, HT, Pr, OP, BF, BL, Se. SetPC, SetSC, SetPW, SetH, SetFC, SetFT, RepC, Diff, Prod, Quot, Mod, Int, Ran, Rem. Also removes any lines starting with a '>'. This allows you to copy output text and paste it back into the editor. The graphics screen is 401 by 401 pixels, with a central Home position of (0,0). If the turtle is visible and moves outside the screen, the border turns grey. Use Label command to help locate a turtle outside the graphics screen. Use the 'grid' button to toggle the background grid on/off. Enter Repeat 22 [Print "] to scroll up and 'hide' text. Info ==== iLogo is a single-page web application. All the programs and info are contained in a single page. Download this page or save to a USB stick to use off line. The Run button resets the turtle and clears all procedures and variables from memory. It's easier to enter commands with spell checkers and auto completers turned off. On an iPad go to 'General' then 'Keyboard' settings menu. Save your eyesight and zoom into the screen. With Mac OS use Ctrl key and mouse scroll wheel. If you need to hide the print text, use Repeat 20 [Print []], and scroll down. Logo Programming ================ iLogo uses space separated words and lists. Any uppercase (capital) letters are converted to lowercase except the Print command where capital letters are preserved. Words are case insensitive, so "a = "A. Words can only contain letters (a-z), numbers (0-9) and underscore (_). There are 4 types of word: 1/ Strings: words with a prefix " (quote) character. eg. "Area_88 is a string of 7 characters. Only the initial quote is needed. Hence " is an empty string - a string with zero characters. 2/ Numbers: words containing only numerals (0-9) and an optional decimal point. Numbers must begin and end with a digit. eg. 3.45 but not .45 Numbers preceded by a space (or '(' or '[') and minus character are negative. eg. -23. 3/ Booleans: words 'true' and 'false'. (Note: cannot use '1' and '0'). 4/ Lists, which contain a series of 'things' (words or lists) between square brackets [ ]. eg. ["Dave :age ["coins 5] false] is a list of 4 things. [] is an empty list - a list with zero things. Words with a prefix : (colon character, called 'dots') are variables. eg. :size Variables allow a value to be stored as a variable name. Values are things or other variables. Valid variable names must start with a letter. When evaluated, a variable is replaced with its stored value. Otherwise, words are treated as procedure names. Procedures are a set of commands, either built-in (primatives) or user defined. There are 2 types: Commands carry out actions (eg. PenUp) Operations output some value (always a thing), (eg. Sum 3 4 outputs 7). to name ip1 ip2... commands end Where 'name' is the procedure name and 'ip1 ip2...' are input things. Valid procedure names must start with a letter. eg. "Name, "size_A4 but not "3rd. Procedures have dynamic scope, so sub procedures can use parent values. Variables and procedures always evaluate to things, so are not additional data types. Control Variables ================= Here are two common control variables, often used in recursive loops. :pm1 either 1 or -1. Invert with 0-:pm1 :tf either true or false. Invert with Not :tf Outputs ======= These commands output 'null': any turtle drawing command. First, Last or Pick an empty string or list. These commands are lost, simply disappear. empty parenthesis () or list []. Abbreviations ============= Error messages and command reference use the following abbreviations: wrd - word (string, number or boolean) str - string chr - character (single a-z, 0-9 or underscore) num - number int - integer t/f - boolean (true / false) thg - thing (word or list) lst - list ind - index (place in string or list, 1-Count) +ve - positive At the moment, error messages reload the parser, which clears all memories. Any code in the Editor is not cleared, allowing the Run button to reload procedures / variables back into memory. Differences =========== There are some differences between iLogo and other Logo versions. 1/ All list items are evaluated. Quote words to prevent evaluation. eg. Show ["rgb "blue "is blue] outputs rgb blue is [0 0 99] and Make "a (Forward 40) will move the turtle forward 40 and make "a [null]. 1/ All primitives have a fixed number of inputs. Multiple inputs are not supported. Use infix operators. eg 3+4+5 Contain in a list. eg Print ["cyan "rgb "is cyan) 2/ Any 'extra' items in an input list are ignored. SetPos [0 0 44] moves the turtle to the home position, and loses the '44'. 2/ Input data types. eg. First 77 throws an error. Use Word " 77 (with empty string) to convert to a string. Likewise, with Sqrt "16 use Integer "16 to convert to a number. Floating point or negative numbers cannot be quoted as the decimal point and '-' characters cannot be contained in a string. Note that single characters can be converted between number and string with Ascii or Char. Useful for printing punctuation characters 'on the fly'. 4/ Comments use # (hash) character. 5/ Fill color declared separately with SetFillColor. 6/ Cannot use '1' and '0' for 'true' and 'false'. 7/ Cannot use ++ to increment or -- to decrement a value. 8/ No queries of pen color, turtle position etc. 9/ Some 'missing' procedures: PenErase and PenPaint - unavailable. Try setting pen to the screen color. PenReverse - effect unavailable. Forever - use a large number. Random n - use Range 0 n Known Issues ============ 1/ Using a value or procedure before it has been described. Program code is read from the top as normal, so values and procedures need to be described first, before they are used. The 'Run' button clears all memories when running Editor code, but not code from the Command Line. Use PrintOutAll to see all user defined values and procedures in memory. 2/ Nested repeat loops do not always reinstate RepCount correctly. Use For loops instead. 3/ All errors reload iLogo, which clears the memory. Run code again to reload procedures and variables back into memory. Web Links ========= Comments to Back to cr31 Main Menu Right click to open Reference and Guide pages in a new tab. iLogo commands are based on Berkeley Logo Commands Reference.
iLogo Command Reference: ============================ Commands: Forward Fd Back Operations: Sum 3 4 Strings: "foo "bar Numbers: 0, 0.1, -20 Booleans: true false Lists: [1 2 [3 4] 5] Variables: :foo :bar Procedures: Name ip1 ip2... Names: are case insensitive, so NoName = noNAME. use letters a-z, numerals 0-9 and _ (underscore). must begin with a letter. Comments: text after a '#' is ignored. =================== Commands Reference: =================== Screen: ======= iLogo begins with a black screen and a white pen. ClearScreen Clear graphics Screen and place turtle at central Home position. CS Also reset pen width, fill trans and screen color. Same as PenUp Home Wipe ShowTurtle PenDown SetPW 2 SetFT 50 SetSC Black. Wipe Clear graphics screen. ClearText Clear text screen. CT Turtle: ======= Home Move turtle to center of screen and set heading to 0. Same as SetPos [0 0] SetH 0. ShowTurtle Make turtle visible. ST HideTurtle Make turtle invisible. HT PenDown Lower pen, the turtle will draw a line as it moves. PD PenUp Raise pen, the turtle will not draw a line as it moves. PU SetPW w Set pen width to w pixels (1-99). If w < 1, w = 1. Default is 2. Drawing: ======== Forward n Move turtle forward n pixels. FD n If n is negative, same as Back n. Back n Move turtle back n pixels. BK n If n is negative, same as Forward n. RTurn d Turn turtle right (clockwise) by angle d degrees. RT d If d is negative, same as LTurn d. LTurn d Turn turtle left (counterclockwise) by angle d degrees. LT d If d is negative, same as RTurn d. RArc d r Move turtle through a right hand arc of angle d degrees and radius r. RA If r is 0 then same as RTurn d. LArc d r Move turtle through a left hand arc of angle d degrees and radius r. LA If r is 0 then same as LTurn d. SetH h Turn turtle to a heading of h degrees, measured clockwise from North. SetX x Move turtle horizontally to x-coordinate x. SetY y Move turtle vertically to y-coordinate y. SetXY x y Move turtle to coordinate position (x,y). SetPos [x y] Move turtle to coordinate position (x,y). Label text Draw label text on the graphics screen, horizontally, in pen color. Same format as Print command, (quotes and outer brackets removed). if PenUp, text aligned centrally at turtles position. if PenDown, text aligned just beyond the turtles nose, and also moved within the screen border. Use Label with the pen down to help locate a turtle outside the graphics screen. Static Turtle: ============== The turtle remains stationary, therefore these commands can be drawn with the pen up or down. Arc d r Draw an arc of d degrees and radius r around the turtle. Arc drawn clockwise for positive d and anti-clockwise for negative d. Note: For an unbroken path use LArc and RArc. Circle r Draw a circle of radius r around the turtle. Same as Arc 360 r. Dot Draw a dot at turtles position using pen color and pen width. Plot [x y] Draw a dot at coordinate (x,y) using pen color and pen width. Patch s Draw a square patch, size s, at turtles position using fill color and transparency. Use patch to fill the screen. eg CS SetFC Cyan SetFT 80 Patch 400. Colors: ======= Pen, fill and screen color can be set using 3 alternative formats: 1/ colorname You can always define your own color names: eg. to colorname output [rr gg bb] end 2/ [rr gg bb] value list Each value auto clipped (0-99). 3/ number (0-15) Use 1+n%7 to avoid Black, or 8+n%7 to avoid last equal density color. Equal Density Colors Black [00 00 00] 0 [30 30 30] 8 Blue [00 00 99] 1 Orange [99 50 00] 9 Green [00 99 00] 2 [15 65 10] 10 Cyan [00 99 99] 3 [00 40 70] 11 Red [99 00 00] 4 [80 05 05] 12 Magenta [99 00 99] 5 Purple [60 30 80] 13 Yellow [99 99 00] 6 [70 70 05] 14 White [99 99 99] 7 [65 65 65] 15 Grey [50 50 50] SetPC Set pen color, colorname / [rr gg bb] / num (0-15). Default is white. SetSC Set screen color, colorname / [rr gg bb] / num (0-15). Includes screen border. Default is black. Print text and turtle sprite are always white, so screen colors are best dark. Light Output rgb color list 50% lighter, eg. SetPC Light Red. Same formats as SetPenColor, colorname / [rr gg bb] / num (0-15). Dark Output rgb color list 50% darker, eg. SetPC Dark Green. Same formats as SetPenColor, colorname / [rr gg bb] / num (0-15). Hue d Output rgb color list depending on angle d degrees, eg SetPC Hue 70. Fills: ====== SetFC Set fill color, colorname / [rr gg bb] / num (0-15). Default is White (appears grey with default transparency and screen color). SetFT t Set fill transparency to integer t, from 0 (no transparency/opaque) to 99 (almost fully transparent). Default is 50. Fill [commands] Fill path described by [commands], using fill color (and transparency). Filled paths begin at the start of the described path or any PenDown command, and are filled at the end of the described path or any PenUp command. An 'evenodd' fill method is used, so self intersecting paths produce filled and unfilled areas. Text: ===== Note: Text is laid over the graphics screen, it can be copied but not edited. Text commands are passed through the turtle, so printing and drawing are in synch. Print Prints text. Use quote to prevent evaluation. Pr Outer list brackets not shown. eg Print ["cyan cyan] prints cyan [0 99 99]. Note: Each print command starts on a new line. Print an empty string or list to create a blank line. An empty string creates an extra space. eg Pr [1 " 2] prints 1 2 with a 2 space gap. Write Same as Print but no new line. eg For ["a 1 4] [Wr :a] Wr Add a final Pr " or Pr [] to place the '>' cursor on a new line. Show Same as Print but outer list brackets, string quotes are shown. s Also null is shown without creating an error. Ascii "c Output Unicode of character c. Ascii " is 0. Char n Output uppercase A_Z or lowercase a-z character of Unicode n, (65-90 or 97-122). char 65 to 96 ABCDEFGHIJKLMNOPQRSTUVWXYZ char 97 to 126 abcdefghijklmnopqrstuvwxyz To convert between upper and lowercase letters, add or subtract 32. Maths Operations: ================= input and output values are numbers (except Int). Sum n m Output sum, n+m. n + m (infix operator) Prod n m Output product, n*m. n * m (infix operator) Diff n m Output difference, n-m. n - m (infix operator) Note: 8 -3 won't work as interpreted as two numbers 8 and -3. Quot n m Output quotient, n/m. Error if m is 0. n / m (infix operator) Mod n m Output n modulo m, n%m. Error if m is 0. n % m (infix operator) Power n m Output n to the power m, n^m. Error if both n and m are 0, or, if n is negative and m is not an integer. n ^ m (infix operator) Int n If n is a number, output integer part of n. If n is a string of numerals, output n as a number. If n is a boolean, output 1 for true or 0 for false. Range n m Output a random integer from m to n (inclusive). eg. Range 1 6 is the same as Pick [1 2 3 4 5 6]. Range 2 -3 is the same as Pick [2 1 0 -1 -2 -3]. Abs n Output absolute value of n. Exp n Output the value of e (Eulers constant) to power n. Exp 1 is 2.718281828459045. Ln n Output natural logarithm (base e) of n. Error if n is negative or 0. Log10 n Output common logarithm (base 10) of n. Error if n is negative or 0. Minus n Output the negation of n. Same as 0-n, or, -1*n. Rem n m Output remainder of integer n / integer m. Error if m is 0. Not the same as modulo when n is negative. Round n m Output n rounded to integer m (0-9) decimal places. If m is 0, then outputs nearest integer. Sqrt n Output square root of n. Error if n is negative. Sin n Output sine of n (degrees). Cos n Output cosine of n (degrees). Tan n Output tangent of n (degrees). ArcTan n Output angle (degrees) whose tangent is n. Constants: ========== pi Output pi, 3.141592653589793 SqRt2 Output square root of 2, 1.4142135623730951 =========== thg -thing, a word or list wrd -word, a string, number or boolean str -string, chr -character, single a-z, 0-9, _ or ? num -number t/f -boolean lst -list ind -index, of character in string or thing in list String & List Operations: ========================= Constructors: ============= Word wrd wrd Output word of first word and second word. List thg thg Output list of first thing and second thing. Sentence thg thg Same as List, except list items have outer brackets removed. Se thg thg FPut chr str Output string with char added as first character. FPut thg lst Output list with thing added as first item. LPut chr str Output string with char added as last character. LPut thg lst Output list with thing added as last item. Mutators: ========= SetItem ind str chr Output string with indexed character in string set to char. Index must be an integer between 1 and Count string. SetItem ind lst thg Output list with indexed item in list set to thing. Index must be an integer between 1 and Count list. Remove chr str Output string with every occurrence of char removed. Remove wrd lst Output list with every occurrence of word removed. Selectors: ========== If string or list is empty output 'null'. First str/lst Output first character in a string, or item in a list. ButFirst str/lst Output string without first character, or list without first item. BF str/lst Last str/lst Output last character in a string, or item in a list. ButLast str/lst Output string without last character, or list without last item. BL str/lst Item ind str/lst Output the indexed character from string or list. Index must be an integer between 1 and Count. Pick str/lst Output random character from string or item from list. Queries: ======== Count str/lst Output number of characters in a string or items in a list. If empty output 0. Empty? str/lst Output true if string or list is empty (" or []), else false. Number? str/lst Output true if string is a number, else false. Booleans: ========= output either 'true' or 'false'. Comparison: =========== output false if words are different data types (string/number/boolean), or either input is a list. Equal? wrd1 wrd2 Output true if wrd1 is the same as wrd2, else false. Case sensitive so "a = "A is false. Note 4 = "4 is true and 0 = false is true. wrd1 = wrd2 (infix operator) Less? wrd1 wrd2 Output true if wrd1 is less than wrd2 (numerical or alphabetical), else false. Same as Not GreaterEqual? wrd1 < wrd2 (infix operator) Greater? wrd1 wrd2 Output true if wrd1 is greater than wrd2 (numerical or alphabetical), else false. Same as Not LessEqual? wrd1 > wrd2 (infix operator) Program Control: ================ Run str Run command string. Must be a single word, so if string is a procedure name, can't have any inputs. Stop Exit the current loop. Output r Exit the current loop with output r (thing). Can only be used within a procedure. Wait n Wait for n 60ths of a second (approx). Can be used to create an animation effect. Variables: ========== Names must be valid, (start with a letter and include only letters, numerals, _ and ? characters). Make "var thg Assign thing to variable named "var, if "var already exists. If not, create a new variable. To recall the value of "var, use :var. eg. Make "age :age + 1. Thing "var Output value of variable "var. Same as :var. (quote to dots) Global "var Make variable "var global in scope, (instead of dynamic). Can only be used within a procedure. Logic: ====== inputs and output are either 'true' or 'false'. And t/f t/f Output true if both inputs are true, else false. Or t/f t/f Output true if either input is true, else false. Not t/f Output true if input is false. Output false if input is true. Iteration: ========== Repeat n [commands] Repeat [commands] n number of times, n must be a positive integer. Note: no Forever command, just use a large number. RepCount Within a repeat loop, output the current repetition count, starting at 1. RepC Note: RepCount is only updated at the start of each new repeat loop. For ["name start limit step] [commands] Repeat commands with var name from start to limit with step size. Name needs preceding quote. eg For ["a 4 11 2] [Write :a] will write 4 6 8 10. Limit can be less than start value. If Step not included, default is 1. Sign of step ignored. eg For ["a 3 -2] [Write :a] will write 3 2 1 0 -1 -2. ForEach ["name string] [commands] Repeat commands with var name for each character in string. Name needs preceding quote. eg ForEach ["a iLogo] [Write :a] will write i L o g o. Conditionals: ============= If t/f [commands] If true, run [commands]. If false, ignore [commands]. IfElse t/f [commands_1] [commands_2] If true, run [commands_1] and ignore [commands_2]. If false, ignore [commands_1] and run [commands_2]. General: ======== Date Output list, [mm dd], month and date. Time Output list, [hh mm], hours and minutes. Diagnostics: ============ POPN Print out of all user defined procedures, showing name and number of inputs. POVN Print out of all current variables, showing name and value. Variables are dynamic in scope. If within a procedure, only variables passed in will be shown. Parse command Print parsed command. eg Parse Print 3 + 4 * 5 To show tokens before parsing, contain in a procedure. eg Parse to test :dist FD :dist + 10 end
Drawing ======= Arc Wave Archimedes Bifur Diag Chessboard Clover Leaf Clover Wave Dartboard Dudeney Eye Sector Ferris Wheels Flowers Golden Spiral Haiku Poem Kam Torus L-Systems Moon and Stars Orbs_1 Orbs_2 PacMan Ghost Petals Pi Island Polygons Poly Spiral Poly Weave Rose Curves Spirograph Spiro_2 Spore Stars String Arts Surface 3d Recursion ========= Brain Curve C-Curve Chirral Star Dragon Curve Fern Fractal Flowsnake Gasket Harriss Spiral Hilbert Curve Hilbert2 Curve Peano Curve Sier Curve Sier Tri Snowflake Sphinx Square Corner Square Splitter Tree Blossom Tree Curve Tree Lean Unit Curve Wirth Curve Illusions ========= After Image Bulge Entwined Kanizsa Neon Patch Ripple Whites Zoom Test/Demo ========= Char Circles Demo Star Fill Paths Grids Hues Labels Mod v Rem Palette Pen Colors Position Recursion PrintShows rgb_Colors Procedures ========== Capital Conv Base Decrement Distance Double Evenp Factorial Fibonacci Half HCF Increment LCM Least Most Oddp Polar-Rect Reverse Shapes ====== Axe Bauble Button Chevron Circle Clover Cross Drop Egg Ellipse Heart Horseshoe Kidney Kite Lens Lune Paragram Polygon Prop Quad Quatra Rectangle Rhombus Salinon Sector SectorAn Square Stadium Star Star5 Triquetra Tulip YinYang Select a program to copy its code into the editor. Procedures and shapes insert code at the text cursor position. Random programs produce a different image each time they're run. Comments ## can be removed to 'commented in' extra code. Recursive programs use a For loop to draw each curve. Adjust the min, max and step values.