Welcome to Logo Lite a small turtle graphics interpreter Quick Start =========== Click the 'Library' tab and select a program. The code will copy into the editor. Use the 'Run' button, or keyboard ‹shift› ‹return› to run code in the editor. You can change the turtle speed while it is drawing. If you are building up a program one step at a time, then start with CS (ClearScreen). Enter short one line commands in the lower command line. Use the 'Go' button, or keyboard ‹return› to run code in the command line. If no entry is made, ‹return› will recall the previous entry. Use the 'Stop' button to stop the turtle. The print screen overlays the graphics screen. Print text can be copied but not edited. The turtle and print text are always white. Use the 'swop' button to swop between two editor code areas. Useful to try out changes or another program. Use the 'form' button to expand or contract common double letter shortforms. rsa, cs, ct, fd, bk, rt, lt, pu, pd, ar, al, st, ht, pr, op, bf, bl, se and SS. Also removes any lines starting with '>'. This allows you to copy and paste print output text into the editor. The graphics screen is 401 by 401 pixels, from -200 to +200. Home position is central [0 0]. If the turtle moves outside the screen, the border turns grey. Some 'static turtle' commands draw without turtle movement so do not trigger a border change. Use the 'grid' button to hide / show a background grid. Info ==== Logo Lite is a single-page web application. All the programs and info are contained in a single page. Save this page to a USB stick to use off line. Only the Web Links won't work. 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 ================ Logo Lite uses space separated words and lists. 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. "Area88 is a string of 6 characters. Only the initial quote is needed. Hence " is an empty string - a string with zero characters. 2/ Numbers: words containing only digits (0-9) and an optional decimal point. Numbers must begin and end with a digit. eg. 123.45 Numbers preceded by a space (or '(' or '[') and minus character are negative. eg. -23.5. 3/ Booleans: words 'true' and 'false'. (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 are variables. eg. :size Variables allow a value to be stored as a variable name. Values are things or other variables. Valid variable names (called symbols) must start with a letter. When evaluated, the symbol is replaced with its stored value. Otherwise, words are treated as procedure names. Procedures are a set of commands, either built-in (primative) 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 plus or minus 1. Invert with Minus :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 (). More than one item within parenthesis. eg. Print (8 11)/4 outputs 2, the 11 is lost. Parenthesis must evaluate to a single value. Extra items within a list. eg. SetPos [0 0 44] moves the turtle to the home position, the 44 is lost. Abbreviations ============= Error messages and command reference may use the following abbreviations: wrd - word (string, number or boolean) str - string sym - symbol (valid string, starts with a letter) 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 =========== The main differences between Logo Lite and more traditional Logo versions are: 1/ Strings must be quoted to prevent evaluation, even inside lists. Otherwise interpreted as a procedure. eg. Show ["rgb "blue "is blue] outputs rgb blue is [0 0 99] and Make "a [Forward 44] will move the turtle forward 44 and make "a an empty list. 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'. 3/ All procedures have a fixed number of inputs. So Pr (Sum 3 4 5) outputs 7 and loses the 5. 3/ Comments use # character. 4/ SetPenWidth not SetPenSize. Limited to 99 pixels. 5/ Wipe instead of Clean (too similar to Clear). 6/ Filled color declared separately with SetFillColor. 7/ Some 'missing' procedures: SetXY - use SetPos [x y], as lists are evaluated. (Sum 1 2 3) - use 1 + 2 + 3. (List :r) - use [:r], as lists are evaluated. Arc d r - use FD r RT 90 ArcR d r LT 90 BK r LT d. PenErase - unavailable, maybe set pen to background color. PenReverse - effect unavailable. Beforep - use Lessp. Forever - use a large number. Known Issues ============ 1/ Using a value or procedure before it has been described. The program code is read from the top as normal, so values and procedures need to be described first, before they are used. Logo Lite saves previous values and procedures. An error message will clear all values and procedures. Deleting from the editor does not delete from memory. Use PrintOutAll to see memory contents. Clear memories with ResetAll command. 2/ Nested repeat loops do not always reinstate RepCount correctly. Use For loops instead. 3/ All errors reload Logo Lite, which clears the memory. Run code again to reload memories. Web Links ========= Comments to guy@cr31.co.uk Back to cr31 Main Menu View Reference and Guide pages in a new tab. Logo Lite commands are based on Berkeley Logo Commands Reference.